Main Menu

Recursive copy dates

Started by Oona22, February 27, 2023, 07:22:43 AM

Previous topic - Next topic

Oona22

Hi all!

I have this folder structure.
-old
 -video
  -2020
   -jan
    001.mov
    002.mov
    003.mov
   -feb
    004.mov
    005.mov

And this for a lot of other years.

Now, I do have a 2nd same folder structure, but then the video's are converted to .mp4 (and do not have creation date in the files.)

-new
 -video
  -2020
   -jan
    001.mp4
    002.mp4
    003.mp4
   -feb
    004.mp4
    005.mp4

I've tried to search the forum and internet to use the exiftool to recursive copy over the media creation date over to the .mp4 files.
exiftool -TagsFromFile -r C:\old\%f.%e  -AllDates -FileCreateDate -FileModifyDate  C:\new\
I tried many more examples, but I'm bit lost. It seems that -TagsFromFile doesnt support -r.
File '-r' does not exist for -tagsFromFile option
I also tried this, but I gives me the error below:

exiftool -tagsfromfile C:\old\%f.mov -r -all:all -overwrite_original C:\new\Warning: Error opening file
I'm clearly don't know what I'm doing. But I'm not able to solve it by myself.
How can I, give the new .mp4 files with the same name the exif creation data from the
old files through all the sub directories and skip files automatically that doesn't have any media creation date?

Thanks in advanced!

win 10, latest exiftool, .mov .mp4

StarGeek

Quote from: Oona22 on February 27, 2023, 07:22:43 AMI tried many more examples, but I'm bit lost. It seems that -TagsFromFile doesnt support -r.
File '-r' does not exist for -tagsFromFile option

If you look at the docs on the -TagsFromFile option, you will see that it is a two part option.  The first part is -TagsFromFile and that must be followed by the source to be copied from.  In this case, you put the -r directly afterwards, so exiftool is looking for a file named "-r".

As for finding the correct file to copy the data from, your command doesn't include the the %d variable which will designate the directory path.  Using C:\old\%f.mov means that all the filenames %f are in the C:\old\ directory, not in subdirectories.

But you can't just use %d, as that will hold the value of C:\new\ and you would end up with C:\old\C:\new\, which is obviously not going to work.  The %d needs to be edited to remove the top two directories.  The "Advanced features" section of the -w (-TextOut) option shows how to do this.

The third example under the %d section shows how to drop the first level with %:1d. You want to drop the top two levels, which means changing the 1 into a 2

Your command would be something like this
exiftool -tagsfromfile C:\old\%:2d%f.mov -r -all:all -overwrite_original C:\new\
"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

Oona22

#2
Thank you for this, that is a clear answer for me, I think..

I tried it with the same example as described above, the short c:/old and c:/new path, and it works great!
But when I try to do it on the files on the external hd, I get:

exiftool -tagsfromfile N:\video\original\%:2d%f.mov -r -all:all -overwrite_original N:\video\converted\

Warning: Error opening file - N:\video\original\converted/0777.mov

For some, probably logical reason, it takes the last called folder and placed it behind the first url.
I tried to figure it out myself, and ask myself why it does work on old/ new/ but not on the subfolder url.

Why does it do this, and how can I change the destination to the correct /converted/ output?
I assume it has something to do with the -w (-TextOut) option, and I need to tell the command to go up to directories?

Phil Harvey

You need to use %:3d instead of %:2d to skip the first 3 slashes in the directory name since you added another level.

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