Windows version DIR creation option fails if the exiftool.exe

Started by andysoft, November 14, 2022, 09:32:02 AM

Previous topic - Next topic

andysoft

Hi
I just installed the exiftool.exe into the Windows/System32 directory to access it from any command line and tried to use it in any directory, the tool works fine, but when it comes to specifying to create a directory and move the files, it fails, just because the failed directory is the .exe running one and not the command line directory

I can help, it's easy to fix this, Are there Sources of the windows Files to Contribute?
BTW: The command is just like the example on the website:

exiftool -d %Y-%m-%d "-directory<datetimeoriginal" image.jpg

Andy

Phil Harvey

The directory should be created in the current working directory.  If you "cd" to Windows/System32 then it would be in there, which you don't want.  You can either "cd" to where you want the directory to be created before running exiftool, or add the target directory to the command, eg)

exiftool -d %Y-%m-%d "-directory<c:/some/directory/name/${datetimeoriginal}" image.jpg

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

StarGeek

Quote from: andysoft on November 14, 2022, 09:32:02 AMBTW: The command is just like the example on the website:

exiftool -d %Y-%m-%d "-directory<datetimeoriginal" image.jpg

This command indicates that image.jpg is in the current directory, which is unlikely if you're currently in the system directory.

Phil gives the example of setting the path directly, but if you're providing a more complete path to the file, say C:\Users\User\Pictures\image.jpg, and you want it to be based off of that directory, then you probably want to add the %d variable (see -w (-TextOut) option) to the command.

When included in the date format string, the % needs to be doubled to differentiate it from the %d that stands for the date
exiftool -d %%d%Y-%m-%d "-directory<datetimeoriginal" image.jpg

or it can be moved to the tag copy operand, which means the tag needs a $ prefix since the operation is now mixing a static string with a tag name
exiftool -d %Y-%m-%d "-directory<%d$datetimeoriginal" image.jpg

Also see Writing "FileName" and "Directory" tags.
"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

andysoft

Thank you for the explanation,
From now on, I'll use those "complicated by useful" syntax-concept (distributed on many help-aka, sections)
 ;D
Andy