I want a wildcard in my file pad how do I do this?

Started by J4c06r1nw1s, October 19, 2021, 08:39:11 AM

Previous topic - Next topic

J4c06r1nw1s

I want a wildcard in my file pad how do I do this?

Example of a file path is:

'/volume1/media/DJI/DJI_AIR_2S/2021/08/31/Plex Versions/Optimized for TV/DJI_AIR_2S__2021-08-31_09.56.35__0005.mp4'


I've tried this but it doesn't work.

exiftool \
    '-AllDates<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' \
    -r '/volume1/media/*/Plex Versions/Optimized for TV/' \
    -i '@eaDir' \
    -ext mp4

Error: File not found - /volume1/media/*/Plex Versions/Optimized for TV/



exiftool \
    '-AllDates<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' \
    '/volume1/media/*/Plex Versions/Optimized for TV/*.mp4' \
    -i '@eaDir'


Warning: Error opening file - /volume1/media/*/Plex Versions/Optimized for TV/*.mp4
Error: File not found - /volume1/media/*/Plex Versions/Optimized for TV/*.mp4
    0 image files updated
    1 files weren't updated due to errors


What am I doing wrong here?



I have found a solution but is this the best way?

find /volume1/media -type f -path '*/Plex Versions/*' -name *.mp4 -exec exiftool '-AllDates<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' '{}' \;

Using ExifTool v12.37 on Linux

StarGeek

Quote from: J4c06r1nw1s on October 19, 2021, 08:39:11 AM
I have found a solution but is this the best way?

find /volume1/media -type f -path '*/Plex Versions/*' -name *.mp4 -exec exiftool '-AllDates<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' '{}' \;

I can't comment on the wildcard problem but I can say this is definitely not the best way.  This is Common Mistake #3.  Exiftool's biggest performance hit is the start up time and this will be extremely slow.

Instead, use find and redirect that output into a temp file.  Something like this.  I don't use Linux/Mac so my apologies if command is off. The temp file should be just a list of the file paths
find /volume1/media -type f -path '*/Plex Versions/*' -name *.mp4  >/path/to/temp.txt

Then, you would feed exiftool that list of files using the -@ (Argfile) option
exiftool -@ /path/to/temp.txt '-AllDates<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}'

One thing to take note of is that in video files, two of the three tags  (CreateDate and ModifyDate) covered by the AllDates short cut are supposed to be UTC according to the spec.  Assuming the time stamp of the filename is in local time, those two tags will be off by the time zone difference.  You can add the -api QuickTimeUTC option to the command and exiftool will adjust the time stamps to UTC when writing.

Also, the commands you list will create the _original backup files.  If you don't want those, you can add the -overwrite_original option.
* 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).

J4c06r1nw1s

Using ExifTool v12.37 on Linux