I am desperately needing to run the linux recovery software foremost
and preserve filenames and folder structure. As you might know the program renames the recovered files with a numerical value and then lists them within a list inside a file called audit.txt that it generates.
I found this ruby
script in another question within this great community where someone is trying to achieve the exact same thing with foremost
that I am. Someone replied to the question with an answer containing a ruby
script with simple instructions to run it within the folder that contains the audit.txt file - I have tried this and nothing happens. I have tried while running foremost
as well as after completed, and nothing happens. I simply get no terminal output when attempting to run the ruby
script you see below.
File.read("audit.txt").scan(/-{4,}\n(File: .*?\n.*?)(?=-{4,})/m).flatten.map{|z|
f1=z.scan(/File: (.*?)\n/).flatten[0];
f2=z.scan(/[0-9]+:\t(.*?) \t/m).flatten;
extension=File.extname(f1);
[
f1,
f2.find{|q| File.extname(q)==extension}
]
}.each{|k,v|
extension=File.extname(k);
dirname=extension.sub(".","")
File.rename("#{dirname}/#{v}","#{dirname}/#{k}")
}
Does anyone else know how to use the program foremost
and preserve filename and folder structure? It is very critical that I am able to do this as foremost
seems to be the one and only recovery program that is capable recovering my files, and I have tried roughly 30+ different recovery programs between both Linux and Windblows.