Im having a little trouble wrapping my head around this issue - I have a batch/HTA pair working together to run exiftool without LOOKING at the command line. I need a way to either plug in variables (set from HTA and imported and applied via batch) and re-date / time the jpegs, or to simply let exiftool do that itself. In this example, the days will set to the next day from whenever its being run, and the time MUST be 12:00:00 (midnight or noon). I cant SHIFT time easily without calculating the shift (seems like more math than should be required) to get the static time / day results ill need.
Note : I tried Dhackneys solution with no luck, and i doubt its a user error... it also didn't do EXACTLY what i needed, so... minimal effort to make it work on my end. https://exiftool.org/forum/index.php/topic,3429.msg15465.html#msg15465
Cheers!
EDIT: To clarify - i need all dates that are going to be left (created and modified cant be removed completely and permanently to my knowledge) to be altered. All other EXIF data is already stripped with the -all command
EDIT v2: I also need to find a way to export the "Complete Failed Unchanged" counts for either a popup window or into a text file, is that something thats readily accessible with piping?
Stripping EXIF and setting all standard EXIF dates to 12:00 the next day may be done like this:
exiftool -all= '-alldates<${now;s/ .*/ 12:00:00/;require "Image/ExifTool/Shift.pl";Image::ExifTool::ShiftTime($_,"1 0",1)}' FILE
(The above quoting is for Mac/Linux. Swap the single and double quotes if you are in Windows.)
You can pipe the summary output to a text file if you want, by adding "1>summary.txt" at the end of the command. (This syntax is for Mac/Linux Bourne shells, but I think it works in Windows too.)
- Phil
That is fantastic! I'm learning quite a bit more about coding thanks to you, with all the improvements over exifer, using exiftool is already so much better. This kind of freedom is one of the main reasons I'm making our company switch. I'll implement this tonight, although I might still hit a snag here and there, so I really appreciate your work both on the tool and the forums.
EDIT: I never clarified yes im on windows and mobile formatted my post awkwardly.
Okay so heres the piece i modified, time change still wont work with me.
pushd %pathvar%
exiftool -all= "-alldates<${now;s/ .*/12:00:00/;require "Image/exiftool/Shift.pl";Image::exiftool::ShiftTime($_,"1 0",1)}" *.jpg >summary.txt
IF EXIST *.jpg_original (
del *.jpg_original
) ELSE (
ECHO No Originals
)
The del portion might not be needed, its there for my own security. I used */12 and */ 12 (spaced and unspaced). Any thoughts? Its driving my a little crazy, would it accept a variable?
In your command you forgot to switch the " to ', you only switched the ' to ". ;D
This should work on Windows:
exiftool -all= "-alldates<${now;s/ .*/12:00:00/;require 'Image/exiftool/Shift.pl';Image::exiftool::ShiftTime($_,'1 0',1)}" *.jpg >summary.txt
If you add -overwrite_original, you don't need to delete the _original file manually.
Hope this helps,
Hayo
THAT did it. I think the only change was quotes.... so yeah i just wasted 1 1/2 hours but you may have saved my neck :D Thank you both.
Don't forget the space before "12:00:00" in the substitution, otherwise ShiftTime won't work (see my first command).
Also, if you want all JPG files, I recommend "-ext jpg ." instead of "*.jpg", because the former also works with -r if you want to process subdirectories.
- Phil
For safety issues I use the del command, I can't afford to risk user error and scrub ALL the photos in any directory other than the one specifically targeted. On a different note, if I want to do Image::exiftool::ShiftTime($_,'1 0',1)}" *.jpg >'%pathvar%\summary.txt' is that an acceptable format? I set pathvar as my working path through an HTA, then command line sets it to the working directory but i want to make sure summary.txt ends up there (maybe i dont even need it since the pushd directory is already where the summary SHOULD end up).
I think your redirection needs to use double quotes, not single. Other than that I don't see a problem.
- Phil
BTW, ExifTool 9.69 now autoloads the Shift module when ShiftTime() is called, which allows your command to be simplified to this:
exiftool -all= "-alldates<${now;s/ .*/ 12:00:00/;ShiftTime($_,'1 0')}" -ext jpg . > summary.txt
As well, we were already in the Image::ExifTool namespace, so Image::ExifTool::ShiftTime(...) could have been written more simply as ShiftTime(...), which I have done above. Plus, the 3rd argument to ShiftTime() is now optional, and not required for a positive shift.
- Phil
That looks way cleaner - for sake of "not broke, why fix?" I left it as is, programs running a few batches each day and giving results 4% smaller than Exifer (our old tool) with no compression. Thats a LOT of power, thank you again.
To put it in perspective - were now cleaning EVERYTHING on our 10TB network drive just to rip another few gigs out of it.