renaming files by CreateDate

Started by j99mac, April 29, 2020, 01:35:03 PM

Previous topic - Next topic

j99mac

I am trying to rename files my CreateDate_model_01

When I run the command it dose not run. what do I need to change to make it run "$input_variable?
Also how to ad a one up number at the end?

exiftool -d '%Y%m%d' '-FileName<${CreateDate;}_${Model;}%-c.%e' "$input_variable"

Phil Harvey

I assume you are on Mac or Linux.  (probably mac due to your user name)

How are you assigning the "input_variable"?

Do you always want the number at the end?  Always 2 digits?  What exactly do you want the number to signify?  You might try something like "-%.2nc".

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

j99mac

Yes on a Mac

This is my full command

echo "Enter the file path of Images"
   read input_variable
exiftool -d '%Y%m%d' '-FileName<${CreateDate;}_${Model;}-%.2nc' "$input_variable

I added -%.2nc

Phil Harvey

You forgot the closing double quote.  But with that, the script should work (but you should add ".%e" to the end of the fie name).  You can test out the passing of variables using the exiftool -echo option if you need to troubleshoot this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).