Linux – How to find all jpeg images of the same camera model


Recently during a installation messup , I lost all my files from my windows NTFS drives. I installed on testdata on Ubuntu 12.10 Desktop edition and with the help of photorec could recover a lot of jpeg images.

Now the problem is they are all named with f[somelargenumber].jpg. Now I want to separate the pics that were clicked from my camera model.

Is there any command through which I can accomplish this task.

Any other alternate solution would also work if it helps solve my problem.

Best Answer

  • Yes. You can read the "EXIF" data from the files. Imagemagic includes a tool "identify" which will allow you to do this.

    You could thus use a command like :

    identify -verbose * | egrep "Image:|exif:Model" | tr "\n" "-" | sed "s/Image:/\n/g"

    To find the model of camera which took the photo, in a format you can further parse (1 file per line) Of-course, you don't need to limit yourself to the model tag - run identify -verbose FILENAME.JPG to list all its attributes.

    (Let me know more specifics if you need help whipping up a script to do the moving etc for you).