Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Not sure I understand what you want to separate: camera pics from... what? – Lizz Mar 16 '13 at 7:04
up vote 3 down vote accepted

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).

share|improve this answer
Thanks a lot . It solved my problem.:) – Poptimist Mar 16 '13 at 6:46
then how to move the matched files to a new folder? – Orion Jul 20 '13 at 11:15
@Orion If you post this as a new question, providing the exif output of a sample image and mention new post as a comment here I can knock together a quick script and post it with that question for you. In general terms though, you could take the output of the command I wrote, pipe it through grep (to isolate the images of interest), and cut (to obtain only the filename), place backticks around this and pass to an MV command. – davidgo Jul 20 '13 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .