Update Files based on Earliest Date or Modified Date

Started by JCombs, April 26, 2021, 12:09:25 PM

Previous topic - Next topic

JCombs

Hi - can anyone suggest how to do a recursive update to set all the file date tags to the earliest date?  An example is that I have some MPG videos that are like this:

File Modification Date/Time     : 2001:11:10 20:26:22-06:00
File Access Date/Time           : 2021:04:26 11:02:21-05:00
File Creation Date/Time         : 2021:04:25 21:37:12-05:00

I want all the dates to be the earliest (in this case, the Modification Date).  I have made numerous attempts but can't get the dates to change using combinations of tags:
exiftool -r "-FileCreateDate>FileModifyDate" <path>
exiftool -r -overwrite_original "-FileModifyDate>FileCreateDate" <path>
exiftool -r "-DateTimeOriginal>FileModifyDate" <path>

Any guidance is appreciated!


StarGeek

Your second command should have worked.  The copy follows the direction of the arrow.  Though it's more common here for the commands to be TARGET<SOURCE, it still works with SOURCE>TARGET

The -overwrite_original option isn't necessary when dealing with file system timestamps, as they are not embedded in the file and the file is not re-written.

If this command is not working, then something else must be going on.
exiftool -r "-FileCreateDate<FileModifyDate" /path/to/files/

Is the disk a local disk or network drive?  What is the OS of where the file is located?  Are there other programs running that might prevent change?  For example, Synology NAS drives sometimes have a background program running that prevents altering the file system timestamps.
"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

JCombs

StarGeek - thanks.   I am using Windows 10 and have a test folder on my desktop:

exiftool -r "-FileCreateDate<FileModifyDate" c:/users/jcomb/desktop/test"

The command does work on the JPG file but there are MPG that do not change.  Maybe this does not work on MPG?

Also - is there a way to read each date tag then select the oldest one and write to the others?

ExifTool Version Number         : 12.25
File Name                       : MVC-589V.MPG
Directory                       : C:/Users/jcomb/Desktop/test
File Size                       : 119 KiB
File Modification Date/Time     : 2001:11:10 20:26:32-06:00
File Access Date/Time           : 2021:04:26 12:45:38-05:00
File Creation Date/Time         : 2021:04:25 21:31:30-05:00
File Permissions                : -rw-rw-rw-
File Type                       : MPEG
File Type Extension             : mpg
MIME Type                       : video/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 2
Audio Bitrate                   : 32 kbps
Sample Rate                     : 32000
Channel Mode                    : Single Channel
Mode Extension                  : Bands 4-31
Copyright Flag                  : True
Original Media                  : True
Emphasis                        : None
Image Width                     : 160
Image Height                    : 112
Aspect Ratio                    : 1:1
Frame Rate                      : 25 fps
Video Bitrate                   : Variable
Image Size                      : 160x112
Megapixels                      : 0.018

StarGeek

This is FAQ #16.  Exiftool normally only processes editable file types.  You can use the -ext (-extension) option to allow processing of files that would be normally excluded.
"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

JCombs

Thank you and that worked.  I had found this option yesterday and was just not sure that was the solution.

Do you have an idea if Exiftool and read all file date tags and then write the others based on the earliest date?

Phil Harvey

Quote from: JCombs on April 26, 2021, 04:25:34 PM
Do you have an idea if Exiftool and read all file date tags and then write the others based on the earliest date?

A quick search in the forum gave this.  There may be other threads on this subject too.

- 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 ($).