Batch copy all metadata from original file

Started by depp454, March 13, 2025, 09:27:34 PM

Previous topic - Next topic

depp454

Hi everyone, I am sure this has been answered a ton but this is my first time ever using the command line.

I am compressing some of my 4K video library (.mp4 .mov) and I am trying to copy all metadata from original mp4s to the compressed mp4s (example 1 below) because the dates (media created date) are changing to todays date which I dont want.

I have gotten both of these below to work for single files only but I cant figure out the batch/full folder/full directory way. Can someone change these for me so that I could do the entire folders instead of just one file?

So for the first example take everything (all mp4) from \2025_03test\ and take all that metadata and overwrite the same named/mirrored, compressed, files in the \3.13comp\ folder?

For the second one, same request, can someone make this a batch command to take all the metadata from the MOV files in the \h_test\ folder and copy that metadata and overwrite the metadata in the same named, compressed .mp4 files, on the \h_compress\ folder?


example 1:
Desktop\exiftool-13.25_64\exiftool -tagsfromfile C:\Users\johnd\Desktop\Photos\2025_03test\1000000132a.mp4 -all:all C:\Users\johnd\Desktop\Photos\3.13comp\1000000132A.mp4

example 2:
Desktop\exiftool-13.25_64\exiftool -tagsfromfile C:\Users\johnd\Desktop\Photos\h_test\IMG_9839.MOV -all:all C:\Users\johnd\Desktop\Photos\h_compress\Img_9839.mp4

thank you so much! A copy paste for me would be ideal as I am very new to this, it took a couple hours just to get to this point.


StarGeek

You would want to look at the percent variables under the -w (-TextOut) option. %d is the directory, %f is the base filename, and %e is the extension.

This will copy all writeable tags that have the same filename and extension in 2025_03test into the files in 3.13comp, based upon the filenames in the target directory
exiftool -TagsFromFile C:\Users\johnd\Desktop\Photos\2025_03test\%f.%e -all:all C:\Users\johnd\Desktop\Photos\3.13comp\

This command drops the %e as you are specifically targeting the MOV files
exiftool -tagsfromfile C:\Users\johnd\Desktop\Photos\h_test\%f.MOV -all:all C:\Users\johnd\Desktop\Photos\h_compress\

If you want to target specific file types in a mixed directory, you would use the -ext (-extension) option. For example, in the second command you would use -ext mp4

Also take note that GPS tracks and actual EXIF data (most video data is Quicktime data) cannot be copied, as they are non-standard in video files. If you delete the originals, you will lose this data.
"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

depp454

thank you so much that was incredibly helpful!!

I did have to make sure my files were named perfect. Compressing removed underscores and put spaces in there, but I just used a batch rename utility and I am all set now. Take care