MS-DOS Batch Function - How To?

The excellent ExifTool utility can move all images in a folder into a year/month/day structure based on shooting date using a simple command:

exiftool "-Directory<DateTimeOriginal" -d "%Y/%m/%d" DIR

where DIR is the folder where the images are located.

I created a button:

exiftool "-Directory<DateTimeOriginal" -d "%Y/%m/%d" {s|noterm}

defined as an MS-DOS Batch Function but it fails. A DOS window appears for a moment then disappears. Images are not moved. When I execute the same command string using the instant command ">" facility it works. What am I doing wrong in the button?

Regards, AB

I don't know how exiftool works but you can do this using Opus by itself:

[Various simple rename presets) (#10)

[Rename help w/Exif Data)


Thanks for reminding me about your DOpus set to shooting date button which is very useful. I had actually looked at it once before and filed for future use.

I imagine that with a bit of hacking I could generate a DOpus version of the ExifTool command to move images into dated folders, but I'd still like to get to the bottom of why the ExifTool command fails from an MS-DOS Batch button but works as expected from an instant command.

Regards, AB

Add the pause command (or @leavedoswindowopen) and see if there's an error message being displayed from the exiftool.


Thanks for the tip. Use of @leavedoswindowopen and DOS echo reveals that the string containing percentage symbols is being interpreted.

echo exiftool "-Directory<DateTimeOriginal" -d "%Y/%m/%d" "{s|noterm}"

Echoed output is: exiftool "-Directory<DateTimeOriginal" -d "m/\ImageDir"
Expected output: exiftool "-Directory<DateTimeOriginal" -d "%Y/%m/%d" "C:\ImageDir"
When entered as an instant command the same string is apparently handled without interpretation.

Regards, AB

You may need to double-up the % characters in a batch script otherwise they'll be interpreted as arguments passed to the script I think.

(e.g. %%Y/%%m/%%d)

Thanks Jon. Doubling up the percentages does the job. It has been a long time since my DOS days.... I'd forgotten that trick.

Regards, AB