Page 1 of 1

Renaming files by date and model

Posted: 05 Aug 2014, 21:33
by m0atz
Ok so I got a whole load of photos back from photorec - as usual it was the best tool for the job.

Now, I've used the following code to rename by any available timestamp in the exif information:

Code: Select all

for i in ./*.jpg; do cp $i ../final/`exiv2 -p s $i | grep timestamp | awk '{ print $4 "-" $5 }'`.jpg; done
and then I've also tried to prepend that with the model number:

Code: Select all

for i in *.jpg; do mv $i `exiv2 -p s $i | grep model | awk '{ print $4 }'`-$i; done
Doing this will prepend the file with say "iphone-2014...jpg" but can it be clearer on the model, i.e. some are iPhone 4 and some are iPhone 5 - how can I get it to give the full model description.

Also - is there a way to Append the info as opposed to prepend it and also skip over any errors?

Thanks

Re: Renaming files by date and model  Topic is solved

Posted: 13 Aug 2014, 18:26
by cgrenier
To append the model, try

Code: Select all

for i in *.jpg; do mv $i $i-`exiv2 -p s $i | grep model | awk '{ print $4 }'`; done

Re: Renaming files by date and model

Posted: 13 Aug 2014, 18:38
by m0atz
Awesome thank you Mr. Grenier.