Main Menu

Configure Output Directory

Started by rainbow, August 23, 2023, 11:55:18 PM

Previous topic - Next topic

rainbow

I am working on setting up a "command" that will re-organize all files in a specified directory into a new directory with a hierarchy of year > month.

The issue is that it sends all these new "year" folders into my "C:\Users\MYUSERNAME" by default, and I cannot seem to find a straight example or explanation of how to change this to something like "C:\Users\MYUSERNAME\OneDrive\Pictures"

Here's what I've got so far. I tinkered with -o and -w a little bit, but couldn't quite wrap my head around them.

exiftool -m -r "-Directory<DateTimeOriginal" -d "%Y/%m" C:\Users\MYUSERNAME\GraduationTesting

StarGeek

There's two ways you can do it. You can prefix the target directory as part of the date format string
exiftool -m -r "-Directory<DateTimeOriginal" -d "C:\Users\MYUSERNAME\OneDrive\Pictures\%Y/%m" C:\Users\MYUSERNAME\GraduationTesting

Or as part of the tag copy operation.  When you mix tag names and static data, you need to add a dollar sign $ to the tag name
exiftool -m -r "-Directory<C:\Users\MYUSERNAME\OneDrive\Pictures\$DateTimeOriginal" -d "%Y/%m" C:\Users\MYUSERNAME\GraduationTesting

Also see Writing "FileName" and "Directory" tags and refer to the -w (-TextOut) option where the %variables (%d, %f, %e) and how to manipulate them is detailed.
* 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).

rainbow

That worked perfectly, thank you so very much!

If it's okay to ask another question related, how do you specify where "unsorted" pictures will go?

StarGeek

See Example #12 on the Writing "FileName" and "Directory" tags page.

You can specify multiple directories and only the last valid one will take effect.  So just place your unsorted directory before any others.

But remember, if you are not using the name of a tag, then you would use an equal sign instead of a less than (see Common Mistake #5c).  For example

exiftool -Directory=/path/to/unsorted/ "-Directory<C:\Users\MYUSERNAME\OneDrive\Pictures\$DateTimeOriginal" -d "%Y/%m" C:\Users\MYUSERNAME\GraduationTesting
* 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).

rainbow

Once again, thank you SO much. Absolute life saver. Think I have it all set up for what I want to do.

This sorts all my selected photos into "Year" > "Month" Folders (Format: 2020 > 01 January), then puts folders that have no DateTimeOriginal data into an "Unsorted" folder. It also ignores minor errors.

exiftool -m -r -Directory=D:\Files_with_no_DateTimeOriginal_Metadata "-Directory<DateTimeOriginal" -d "D:\%Y/%m %B" D:\Folder_Name