Changing the dates of all files in a folder that start with "YYYY-MMDD"

Started by ImNotVerySmart, March 15, 2022, 12:23:51 AM

Previous topic - Next topic

ImNotVerySmart

Can this be done? I have a group of mp4 files in a folder with varying names. There are more mp4s files in subfolders within that folder. The folder name starts with YYYY-MMDD. Can I use a command to adjust the dates for all the mp4 files in the folder, along with any in subfolders?

I.e. A folder name is 2007-0112. Can I get that string and put it into, preferably, the -quicktime:createdate tag as 2007-01-12 00:00:00? And can this be done to all files in the subfolders also?

StarGeek

Try
exiftool "-Quicktime:CreateDate<${Directory;m/(\d{4}-\d{4})/;$_=$1} 00:00:00" /path/to/files/

You can't cd to the 2007-0112 directory. You have to either cd to the directory above it or give the full path, e.g c:/path/to/2007-0112/ 

The command looks for a pattern of 4 digists(dash)4 digits and replaces the directory name with that match.  The 00:00:00 is than added to the end of that. Because of FAQ #5, 3rd paragraph, exiftool is flexible about the formatting of the numbers and will split the resulting 14 digits up into the a proper date/time.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

ImNotVerySmart

So I'm running a .bat file for this and I have it written like this:

exiftool -api QuickTimeUTC "-Quicktime:CreateDate<${Directory;m/(\d{4}-\d{4})/;$_=$1} 00:00:00" "A:\3D Animation\!Exiftool\FolderDates\2014-0216"

pause


This works perfectly for the files in the 2014-0216 folder, awesome thank you! Now, say I have multiple folders in the directory. I tested with just 2 folders to start. One is 2014-0216 and the other is 2015-0315. How would I write this so that it does this to both of these folders?

exiftool -api QuickTimeUTC "-Quicktime:CreateDate<${Directory;m/(\d{4}-\d{4})/;$_=$1} 00:00:00" "A:\3D Animation\!Exiftool\FolderDates"

pause


This gives me a message saying 1 directory scanned but 0 image files read.

StarGeek

My standard copy/paste which I should have added.

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

ImNotVerySmart