The generic pattern-named files that photorec produces are not very useful to us. Our data has been recovered, but it'd be quite a task to go back through and rename all of our files to something useful one by one. Luckily with a little scripting we don't have to do that. Here is a quick script using rdjpgcom from the libjpegprogs package to read the comment from the EXIF field in the photo and rename the file accordingly.
#!/bin/bash NEW_FILENAME=`rdjpgcom $1 | tr " " "_"`.jpg mv $1 $NEW_FILENAMENow we just execute the following find command
find /path/to/recovered_files -iname "*.jpg" -exec rename_pic.sh '{}' \;
and we end up with appropriately named photos.
Here is a link to a small script that we can use to do this with our music files. We just run the following find command
find /path/to/recovered_files -iname "*.mp3" -exec id3rename '{}' \;
and we end up with our music files named appropriately.
With a little scripting you can apply this technique to any of the file formats that contain metadata. It's much better than renaming all of those files one by one.
![[logo]](logo.png)