Moving files based on makernotes tag

Started by vulpess, January 19, 2022, 09:38:29 AM

Previous topic - Next topic

vulpess

Hi,

I am a completely newbie when it comes to programming and coding and need some help for a specific task.

The scenario is the following:
I have a folder with a lot of jpg-files. Each file has either "A" or "B" in a specific makernotes tag.
I want to move the files with "A" into a subfolder named "A" and the files with "B" into a subfolder named "B".

Is there a solution with ExifTool?

Thanks in advance!

Cheers,
Lukas

StarGeek

Probably, but it may depend.  This command will move files into a directory with the exact name in the tag.
exiftool "-Directory</path/to/target/${TAG;}" /path/to/files/

Replace /path/to/target/ and /path/to/files/ with the actual paths to the target and source directories.

Replace TAG with the actual name of the tag.  Make sure it's the tag name and not the description (see FAQ #2 and FAQ #3).

Since I don't know the exact tag, I've added the braces and the semicolon.  This will make sure that characters that would be illegal in a file name, such as colons/slashes on Windows, will be removed.

Also, files that don't have that tag will not be moved.  You can set a default by placing another Directory assignment first.
exiftool -Directory=/path/to/default/ "-Directory</path/to/target/${TAG;}" /path/to/files/

If you're running under Mac/Linux/Powershell, change the double quotes to single quotes.

See Writing "FileName" and "Directory" tags for more details.
"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

vulpess

Wow, that worked! Thanks so much, I would never have come up with anything similar  :o