ExifTool Forum

ExifTool => Newbies => Topic started by: ejbrownlf on September 03, 2022, 12:09:23 PM

Title: Creating nested folder structure based on multiple tags in flac files
Post by: ejbrownlf on September 03, 2022, 12:09:23 PM
I have a a large amount of flac files that are completely unorganized. I'd like to create a script that would sort them in a Parent folder of the Artist name and have sub folders within each artist for their albums and put each song in those album folders

exiftool '-Directory<${Artist}/$Album' z:/Music/Artists/ z:/flac
This is what I wrote but unsure if this will actually do what I am trying to do.

Thanks for any help
Title: Re: Creating nested folder structure based on multiple tags in flac files
Post by: StarGeek on September 05, 2022, 01:25:26 PM
Change Directory to TestName and then run the command.  Exiftool will tell you what the new directories will be called without actually moving the files, though you will get warnings that about the file already existing.  That's because TestName is checking file names, not directories.

If the output looks correct, then you can run the command for real.

The command you list will check all the files in both "z:/Music/Artists/" and "z:/flac", but not any subdirectories.  Is what you actually want to do is move the files from "z:/flac" into "z:/Music/Artists/"?  If that's the case, you want to put the target directory before ${Artist}.

Also, because there might be slashes or other characters in the Artist or Album that might not be legal for a file name, then a semicolon needs to be added in the tag name.  Without it, then a name like "AC/DC" will create a new directory.  You would end up with a path like "z:/Music/Artists/AC/DC/Highway To Hell/file.flacc"

So I think you want
exiftool '-Directory<z:/Music/Artists/${Artist;}/${Album;}' z:/flac

If you need to read subdirectories as well, add the -r (-recurse) option (https://exiftool.org/exiftool_pod.html#r-.--recurse).