Tag Archives: FSlint

Recovering Pictures from a Cell Phone

I recently had a crash on my phone where I thought I lost the majority of my pictures. Luckily, I was able to do a recover using PhotoRec. The only problem is that for some reason, there was a glitch with the file system on my phone and each time it neared the end, the program would go backwards several thousand sectors and start recovering the same files all over again.

The next problem was that I had several duplicate files and needed to prune redundancies. Thankfully there was a program, FSlint, that was designed to do just that. Using a file size, MD5sum, and SHA1sum analysis regiment to find the duplicate files, I was able to eradicate all of the extra, unnecessary, redundant versions of each picture.

Now my problem was that I had several recoup.dir directories. I wanted to take all of the JPEGs from their respective folders and move them to a single, good folder. Searching around the Internet led to this post on LinuxQuestions.org. Their suggested command worked beautifully:

find (start directory) -iname “all my files type” -exec cp {} (target_dir) \;

Now I had all of my pictures recovered, duplicates removed, sitting in a single directory, however, their original file names and dates were incorrect. Thankfully I found this little handy script on TuxRadar that allowed me to rename the files and update their timestamp according to their embedded EXIF data:

find -name ‘*.jpg’ | while read PIC; do
DATE=$(exiftool -p ‘$DateTimeOriginal’ $PIC |
sed ‘s/[: ]//g’)
touch -t $(echo $DATE | sed ‘s/\(..$\)/\.\1/’) $PIC
mv -i $PIC $(dirname $PIC)/$DATE.jpg
done

Thanks to the wonderful world of FLOSS, I was able to complete my mission of recovering my, once lost, pictures, rename them according to their meta data, and live a happy Saturday. I love the community.