Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How do I convert files and output to a new folder on the same level as source? (Read 788 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How do I convert files and output to a new folder on the same level as source?

Hey everyone. I've been a foobar2000 user for perhaps the past 3 years now and it's treated me tremendously, and as I discover new features about it, I fall deeper in love with. However, I've come to a standstill with what I've been trying to do with the music player, and that is when I convert the music, I want the output files to be stored in a new, separate folder made automatically one level above the source folder. If the folder doesn't exist, it will be made; if the folder does exist, the files will just output there and override any existing files in that folder anyway.

Context: My music is all sorted as follows: "S:\My Music\Artist Name\Album\". I typically save all my music in FLAC, and in that case, following \Album\, I'd have folders sorting the music by the file type (if, for whatever reason, I have files for the album beyond FLAC ex. AAC).
Example:
"S:\My Music\Artist Name\Album\flac",
"S:\My Music\Artist Name\Album\aac",
etc.

However, not all of my albums have an AAC or whatever-file-type version of them. Most albums in my library just have a FLAC copy. The two example directories are exactly what I'm trying to achieve with foobar2000 conversion, so that I wouldn't have to manually make file type folders in each and every one of my albums' folders.

Having attempted this by myself, I've tinkered with the foobar2000 file name formatting in the Converter Setup window as it's gotten me the closest to what I'm trying to achieve, but I've only gotten as far as this:
$replace(%path%,$left(%path%,45),,%filename_ext%,aac\%filename%)

I've pressed "Specify folder" and set the directory to "S:\My Music\". With that name format, the directory "S:\My Music\Artist\Album\" is retained, but the files output to "S:\My Music\Artist\Album\flac\aac\", which isn't intended - as mentioned above, I want the conversion process to basically sort for me the album by file type, such that when I press convert, the files in "S:\My Music\Artist\Album\flac\" go to "S:\My Music\Artist\Album\aac\", or "S:\My Music\Artist\Album\wav\", or what have you.

I will admit I'm pretty dumb when it comes to the whole file name formatting syntax scheme (I've essentially done very little research myself using the title formatting reference itself and have only really scoured forums to find a quick answer), which is why I've decided to come here and have you lovely folk - that, most definitely, are more knowledgeable than me - help me sort my little conundrum. :P

tl;dr: "I want the [foobar2000] conversion process to basically sort for me the album by file type, such that when I press convert, the files in "S:\My Music\Artist\Album\flac\" go to "S:\My Music\Artist\Album\aac\", or "S:\My Music\Artist\Album\wav\", or what have you."

Thank you in advance to anyone who replies. This is my first post, and I will most likely be coming back for more.

Re: How do I convert files and output to a new folder on the same level as source?

Reply #1
Hi there,
Are your files correctly tagged such that they match the folder names for "Artist\Album"? If so, why not simply use tags -

Under 'Output style and file name formatting > Name format' -

For AAC preset -
Code: [Select]
%album artist%\%album%\aac\%filename%

For WAV preset -
Code: [Select]
%album artist%\%album%\wav\%filename%

Etc... making a different preset for each format you want to convert to. Edit: If you really need to replicate folder structure, codec folder is done the same way, different preset per format.

Re: How do I convert files and output to a new folder on the same level as source?

Reply #2
While your method is totally valid, occasionally I have files where the album artist field doesn't equate to the artist field.

Take, for example, a file with "Various Artists" listed in the album artist field, but the actual, specific artist is listed in the artist field; that file may not even be in the directory, ex. "S:\My Music\Various Artists\Album", and instead be in ex. "S:\My Music\Actual Artist\Album"; sometimes I do this when I'm holding onto one specific song from an artist, and that song comes from a compilation where I'm not interested in the other songs.

In short, I'd like to clarify that whatever naming format I'm looking for with my ideal conversion process doesn't rely on tag data (to avoid any errors in tagging if there shall be any) and simply backtracks one level in the directory to create a new folder on the same level as the source.

Though, it wouldn't kill me to manually sort every now and then. Regardless, thank you very much for your response, anamorphic.

Re: How do I convert files and output to a new folder on the same level as source?

Reply #3
(So I maybe was looking at your code and thinking you were trying something not possible, sorry about that)

Anyway, what about this -

For AAC preset -
Code: [Select]
$replace($directory_path(%path%),$left(%path%,12),,%directory%,aac)\%filename%

$left(%path%,12) replaces S:\My Music\ with nothing. Following that, "Artist\Album" folders in the middle are not changed.

%directory% is the source folder, replaced with conversion format (aac) - change this for each preset.

Re: How do I convert files and output to a new folder on the same level as source?

Reply #4
Or this might be safer -

Code: [Select]
$replace($directory_path(%path%)\,$left(%path%,12),,\%directory%\,\aac\)%filename%

I added extra backslashes to make sure it only replaces the source folder and not part of the other folders, just in case the source folder is "wav" for example that might also be part of "Artist\Album" name. Hopefully works. :D

 

Re: How do I convert files and output to a new folder on the same level as source?

Reply #5
Or this might be safer -

Code: [Select]
$replace($directory_path(%path%)\,$left(%path%,12),,\%directory%\,\aac\)%filename%

I added extra backslashes to make sure it only replaces the source folder and not part of the other folders, just in case the source folder is "wav" for example that might also be part of "Artist\Album" name. Hopefully works. :D

Oh my Jesus. You're a saint. This worked perfectly. Thank you so, so much.