Author Topic: Format Converter on a batch of albums that preserves folder structure?  (Read 2839 times)

Skoop

  • Sr. Member
  • ****
  • Posts: 277
Is it possible to select multiple album covers and then Send to> Format Converter, and output to another drive that preserves the folder structure of where the library files are stored on the PC? 

One of the output options is to a new folder, with "organise sub-folder and filename", but I don't know if that will do it or how to do it. 

Can this be done without doing it album by album manually? 

I'm using v2.5.5804.

Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2463
This can be done.

Create a virtual tag to remove your current music folder path and file extension from the original file path.
For converting FLAC files I have in the folder M:\Music, I use this:

Code
$Replace($RxSplit(<URL>,"M:\\Music",2),.flac,)
On the File Converter dialog screen:

Select the Or to a new folder option, and select the root folder (or drive) for where you want to keep your converted files.
Also check Organise sub-folder and filename and for that path select the name of the virtual tag you created.

Note that in theory you could skip the virtual tag and just enter that formula directly into the sub-folder field.
In practice, from memory there's a bug that prevents the Replace formula from working there, hence the need for the tag.
Bee excellent to each other...

Skoop

  • Sr. Member
  • ****
  • Posts: 277
Is that converting to flac or from flac?  Not quite following there.

My folders are a mix of wav, flac, and mp3 files.  I'm looking to go over all of them to convert to mp3 at a smaller file size, to put on a single drive to plug into the car.  So do I need to convert them file type by file type, or will that formula work globally?  

If my music files are in folders under the root D:\media, the formula would be

$Replace($RxSplit(<URL>,"D:\Media",2),.mp3,), or is it double backslash?  Correct?

Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2463
All the formula does is remove the original base music folder from the original file path so that the remaining folder structure gets used for the new file.

The $RxSplit function gives the remaining part of the file path.
This includes the original file extension, so the $Replace function removes it. Otherwise, you'll end up with something like filename.flac.mp3.

My example was for converting from FLAC to something else, but it will work for any format.
Looking at this again, I've realised the $RxSplit function could also be used to remove the file extension.

Use something like this:
Code
$RxSplit(<URL>,"D:\\Media|.flac|.mp3|.wav|.m4a",2)

Add any file extensions you need to convert from to the formula, separated by | characters.

Backslash characters have a special meaning in regular expressions, so you need two to treat it as if it were only one.

e.g.
For the file
D:\Media\B\Billy Joel\1978 - 52nd Street\01 - Big Shot.flac

The formula will return
\B\Billy Joel\1978 - 52nd Street\01 - Big Shot

The folder you specify in the File Converter dialog gets added to the start, the file extension for the new format gets added to the end, and your newly converted file keeps the same folder structure as the original.

-edit-
I just noticed the version of MusicBee you're using is super old. So no guarantees this will work for you without upgrading.
Bee excellent to each other...

Skoop

  • Sr. Member
  • ****
  • Posts: 277
I don't think I'm doing this correctly.  In the virtual tag dialog, I created "Convert" in place of "Virtual2", and when I pasted that formula into the dialog ($RxSplit(<URL>,"D:\\Media|.flac|.mp3|.wav|.m4a",2)), it errors out.  Cannot parse.

Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2463
You've got an unnecessary extra set of parentheses around the formula, but I also found this post that shows the RxSplit function was only added in MusicBee 3.1

https://getmusicbee.com/forum/index.php?topic=20925.0


So if you're still running 2.5 (which is now almost 4 years old!) it won't.
Bee excellent to each other...

Skoop

  • Sr. Member
  • ****
  • Posts: 277
They're not extra--it was a parenthetical insertion into my sentence, as a reference to "that formula".  When I tried it as you laid it out, it didn't work, and now I know why.  It's the version I'm using. 

Thanks for your time on this.  I'm not upgrading because I don't want to retweak everything.  I have a simple setup, most of my library is classical, I don't use lyrics or side panels or other bells and whistles.  It's a terrific app just as it is; don't need to fix what isn't broke. 

Thanks again.