Batch copying creation date from one group of photos to another

Started by chartno3, July 11, 2015, 08:59:25 AM

Previous topic - Next topic

chartno3

I have two folders of images, both with identical file names and extensions. I need to the images in the second folder to have the same creation date as the first folder. I'm on Mac and have my command line ready but not sure how to proceed. Any help would be appreciated!

Phil Harvey

The command could look something like this:

exiftool -tagsfromfile SOURCEDIR/%f.%e -exif:createdate DESTDIR

This will change the EXIF CreateDate.

But if you are talking about the filesystem creation date, and you are on Windows, use -filecreatedate instead of -createdate.  Or if you mean XMP, use -xmp:createdate.  Or if you mean...

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

mpwm64

Hi there, I'm trying the very same thing, only with a bunch of .wmv videos that I've just converted (using HandBrake) into .mp4 files. Same filenames. All I want is for the original creation dates to carry over. I'm on a mac (Catalina). I get the error "File is empty  - /Users/[USER]/Movies/HandBrake/Source" when I run this command:

exiftool -tagsfromfile /Users/[USER]/Movies/HandBrake/Source /%f.%e -exif:filecreatedate /Users/[USER]/Movies/HandBrake/Destination

Any ideas? The .wmv file is in there, and it certainly has a creation date. I also tried with -exif:filemodifydate but same error.

Phil Harvey

You need to put quotes around any argument that has spaces in it.  But I don't think you wanted the space after the "Source " directory name.  Maybe you meant this?:

exiftool -tagsfromfile "/Users/[USER]/Movies/HandBrake/Source/%f.%e" -exif:filecreatedate /Users/[USER]/Movies/HandBrake/Destination

- Phil

Edit:  Another problem:  Just use -filecreatedate.  This tag is not in the EXIF.  So the command should be:

exiftool -tagsfromfile "/Users/[USER]/Movies/HandBrake/Source/%f.%e" -filecreatedate /Users/[USER]/Movies/HandBrake/Destination

I assume you are on Mac.  If so, this command should set the filesystem creation date/time, but you may need to install the setfile utility (with xcode-select --install in a Terminal window).
...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 ($).

mpwm64

Update: Success!

So I don't know what went wrong with what I was trying before (see below), but I was able to make this work by just having them in the same directory:

exiftool -tagsfromfile %d%f.wmv -filecreatedate -ext mp4 /Users/[USER]/Movies/HandBrake/Other

Not sure what went right, but this will save heaps of time. Thanks for creating this!

------

Thanks Phil, that clears up some things! Unfortunately, I ran into a new error:

Warning: Error opening file - /Users/[USER]/Movies/HandBrake/Source/video1.mp4
    1 directories scanned
    0 image files updated
    1 image files unchanged


I tried it again with two image files instead (JPEG and a TIFF), and I got the same error. So I don't think there is anything uniquely wrong with my .mp4 files. Maybe I have something wrong with my permission settings?

Yes, I'm on mac, running Catalina. I already have command line tools installed, or at least this is the message I got:

xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates


Also:
xcode-select -v
xcode-select version 2373.


I take it that means I already have the setfile utility?



Phil Harvey

I'm glad you figured out your problems, but I'll address some comments anyway:

Quote from: mpwm64 on April 17, 2020, 03:25:44 AM
Warning: Error opening file - /Users/[USER]/Movies/HandBrake/Source/video1.mp4

I'm assuming you replace your name with "[USER]" in the warning above.  If the file exists with exactly this path, then the only thing that will cause this message is a permission problem.

QuoteI take it that means I already have the setfile utility?

If ExifTool doesn't give you an "Error running setfile", then you don't need to install it.

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

mpwm64

Thanks! Yes, I've been manually censoring my username, which is my full legal name. (Probably should change that somehow.)