Renameing files with date and time

Started by j99mac, October 27, 2021, 09:13:20 AM

Previous topic - Next topic

j99mac

I am looking to rename files based on CreateDate and CreateTime. Is it posable to add a custom Date and Time to filename? The Date format I am looking for is yymmdd and the time format is hmma. I the without any: in the date or time.
Would this command work?
exiftool -d '%Y%m%d''%h%mm$a' '-FileName<${CreateDate;}_$Num_${CreateTime;}_Start%.2nc.%e' "$files"

StarGeek

I don't believe there's a tag called "CreateTime".  At least I can't create one with exiftool.  Where are you getting the value for this?

If you want to have two different date formats, then you need to use the DateFmt helper function.  Something like
exiftool '-FileName<${CreateDate;DateFmt("%Y%m%d")}_$Num_${CreateTime;DateFmt("%H%M")}_Start%.2nc.%e' /path/to/files/
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

j99mac

Would this put the date and the time form DateTimeOriginal feild?

StarGeek

I was just using your original post as an example.  I still don't know where you got this "CreateTime" tag from.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

j99mac

I Thought that there was a Create time.
Could this be used DateTimeOriginal

Phil Harvey

You can use any tags that you find with this command:

exiftool -s -time:all FILE

- 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

is this better
exiftool -p "${DateCreated}_$Num_${TimeCreated}_Start.tif" -d %Y%m%d_%H%M%S%%-c /path/to/files/

This is what I want the file name
211027_%Num_100010_Start.tif

Phil Harvey

OK.  So you can use most tags that you find with the command I gave.  But it must be a date/time tag.  Use DateTimeCreated instead of DateCreated and TimeCreated.  Does the DateTimeCreated tag exist in all your files?

Also, I don't know what you are trying to do with $Num in the name.

- 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 there is a date/time tag in my files. If I cange DateCreated to DateTimeCreated and TimeCreated to DateTimeCreated  can I make one have date  and the other have just time

$Num I a read Veriable where a user cam example

Echo "Enter a Number"
read Num

Phil Harvey

I can't help with your $Num (are you on Windows? are you executing this from a batch file?  If so, then it is likely %Num%, and all other % characters need to be doubled.)

Quote from: j99mac on October 27, 2021, 01:56:15 PM
If I cange DateCreated to DateTimeCreated and TimeCreated to DateTimeCreated  can I make one have date  and the other have just time

StarGeek showed you how to do 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 ($).

j99mac

This is what he has
exiftool -r '-FileName<CreateDate' -d '%Y-%m-%d/%H_%M_%S%%-c.%%le' <yourFolder>

I am looking for the name to be date_veriable_Time_Start

StarGeek

Quote from: StarGeek on October 27, 2021, 10:17:07 AM
exiftool '-FileName<${CreateDate;DateFmt("%Y%m%d")}_$Num_${CreateTime;DateFmt("%H%M")}_Start%.2nc.%e' /path/to/files/

You'll have to figure out what the exact tag you want to use is and you'll have to figure out the proper context for your variable, but otherwise your command is along these lines.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

j99mac

I get" no writable tag sets" when running the comand

Phil Harvey

We are going around in circles here.  Please read our previous posts
...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 ($).