====================== Pictures (jpg, jpeg) ======================
Its unfortunate, but the command-line now being posting cannot write to the exif-dates, because its missing the -AllDates parameter.
If you did only change -testname ===> -filename, then it would only conduct the renames, but not write to any of the exif-dates!
Im hoping that you did probably just post the wrong command-line, so that your pictures can already have the correct dates?
viewtopic.php?f=12&t=5793#p15911So before conducting any videos, please to use the below command to compare each picture's exif-date to its new filename.
- Code: Select all
C:\Users\ricar\exiftool -s -m -r -ext jpg -ext jpeg -progress:"ExifTool %p%%" -if "$filename=~/201\d{3}-\d{3}\.jpe?g$$/ and (${AllDates;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filename;s/^(.{6}).*/$1/})" -p "$filename" "C:/Users/ricar/exif-finished"
If any filenames present, its because the month/year in their exif-date is
different from the month/year in their filename.
So to rewrite these exif-dates by looking at the filenames instead of folder-paths, you can now just change...
-s ===>
-overwrite_original and
-p "$filename" ===>
-AllDates"<${filename;s/^(\d{4})(\d{2}).*/$1:$2:01 00:00:00/}" You could run the 1st-command again, just to verify that all of the exif-dates have the same month and year that is inside of their filenames.
After you verified the pictures all have correct exif-dates, but worry for duplicate filenames in DCIM (because you conducted them too)??
I would just use the bru to append something like --fixed, or whatever the difference is between your 'DCIM' and 'exif-finished' folders?
====================== Videos (3gp, mp4) ===========================
Its unfortunate, but
not $AllDates will succeed with videos, because their unknown-dates often get written like 0000:00:00 00:00:00 !!
Videos do also have much more metadata for their dates, so you will need more -TagNames to conduct the same, like with your jpegs.
Also, if any videos can be larger than 4GB, then must add
-api LargeFileSupport, but this does makes conducting videos
much slower!
To compare all video-dates to their folder-path, from /whatsapp videos/201308-->201905/, its a much longer command like...
- Code: Select all
C:\Users\ricar\exiftool -m -r -ext mp4 -ext 3gp -api QuickTimeUTC -progress:"ExifTool %p%%" -if "($Filepath=~/\/2013(0[89]|1[012])|201[4-8](0[1-9]|1[012])|20190[1-5]\//) and ((${AllDates;s/^(\d{4}):(\d\d).*/$1$2/} eq ${filepath;s/.*\/(201\d{3})\/.*/$1/}) or (${MediaCreateDate;s/^(\d{4}):(\d\d).*/$1$2/} eq ${filepath;s/.*\/(201\d{3})\/.*/$1/}) or (${MediaModifyDate;s/^(\d{4}):(\d\d).*/$1$2/} eq ${filepath;s/.*\/(201\d{3})\/.*/$1/}) or (${TrackCreateDate;s/^(\d{4}):(\d\d).*/$1$2/} eq ${filepath;s/.*\/(201\d{3})\/.*/$1/}) or (${TrackModifyDate;s/^(\d{4}):(\d\d).*/$1$2/} eq ${filepath;s/.*\/(201\d{3})\/.*/$1/}))" -p "$filepath" "C:/Users/ricar/Downloads/whatsapp videos"
I did make this the opposite of the last time with jpegs, so now there is not needed to look inside of any preview-file.
Its only presenting file/path/names, when it finds any video-date that
matches the same year and month inside of the folder-path.
The $AllDates will look many more places inside of videos, but not in Media*Dates and Track*Dates, so they are added for the search.
If any of your dates has a correct yyyymm, then you can use it to set the other dates, so then saving the correct day and times also.
But if no filepaths are presented, this would mean that all of your dates have the wrong yyyy:mm (if the folders are to be correct).
And you would have to conduct the videos like your jpegs, using the folders and guessing 01 00:00:00 for the day and time.
IF you did already verify that
all of the dates are bad, this to conduct like the jpegs...
- Code: Select all
C:\Users\ricar\exiftool -m -r -overwrite_original -ext mp4 -ext 3gp -api QuickTimeUTC -progress:"ExifTool %p%%" -if "($Filepath=~/\/2013(0[89]|1[012])|201[4-8](0[1-9]|1[012])|20190[1-5]\//) and (${AllDates;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filepath;s/.*\/(201\d{3})\/.*/$1/}) and (${MediaCreateDate;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filepath;s/.*\/(201\d{3})\/.*/$1/}) and (${MediaModifyDate;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filepath;s/.*\/(201\d{3})\/.*/$1/}) and (${TrackCreateDate;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filepath;s/.*\/(201\d{3})\/.*/$1/}) and (${TrackModifyDate;s/^(\d{4}):(\d\d).*/$1$2/} ne ${filepath;s/.*\/(201\d{3})\/.*/$1/})" -AllDates"<${Filepath;s/.*\/(201\d)(\d{2})\/.*/$1:$2:01 00:00:00/}" -Media*Date"<${Filepath;s/.*\/(201\d)(\d{2})\/.*/$1:$2:01 00:00:00/}" -Track*Date"<${Filepath;s/.*\/(201\d)(\d{2})\/.*/$1:$2:01 00:00:00/}" -Filename"<C:/Users/ricar/exif-finished/${filepath;s/.*\/(201\d{3})\/.*/$1/}%-.3nc.%e" "C:/Users/ricar/Downloads/whatsapp videos/201???"
After writing to the dates, it does then rename and move the files like...
C:\Users\ricar\Downloads\whatsapp videos\
201510\Media\Phone#\8\e\aaa.mp4 ====> C:\Users\ricar\exif-finished\
201510-001.mp4
C:\Users\ricar\Downloads\whatsapp videos\201510\Media\Phone#\7\f\bbb.mp4 ====> C:\Users\ricar\exif-finished\201510-002.mp4
C:\Users\ricar\Downloads\whatsapp videos\
201803\Media\Phone#\d\1\aaa.mp4 ====> C:\Users\ricar\exif-finished\
201803-001.mp4
C:\Users\ricar\Downloads\whatsapp videos\201803\Media\Phone#\8\2\bbb.mp4 ====> C:\Users\ricar\exif-finished\201803-002.mp4
C:\Users\ricar\Downloads\whatsapp videos\201803\Media\Phone#\2\e\aaa.mp4 ====> C:\Users\ricar\exif-finished\201803-003.mp4
C:\Users\ricar\Downloads\whatsapp videos\
201908\Media\Phone#\2\e\aaa.mp4 ====> (no changes, because
201908 is out of range)
Remember it only looks beneath /whatsapp videos/201308-->201905/, and it only conducts videos if
all of their dates dont match the folder-path.
Must also add
-api LargeFileSupport if videos can be >4GB, and just change exif-finished to wherever you really want to settle your videos.
If you like to add some
-suffix, you can change it like .3nc.%e ===> .3nc
-suffix.%e (inbetween the "c" and "." or just use the bru later).
Many apologies for not seeing the post, its good you make another one!