Renaming files by date and model Topic is solved

Using PhotoRec to recover lost data
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
m0atz
Posts: 5
Joined: 28 Jun 2014, 22:11

Renaming files by date and model

#1 Post 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

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Renaming files by date and model

#2 Post 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

m0atz
Posts: 5
Joined: 28 Jun 2014, 22:11

Re: Renaming files by date and model

#3 Post by m0atz »

Awesome thank you Mr. Grenier.

Locked