Is it possible to rename/move _PARENT_DIRECTORY yet?

I've found 2 oldish posts discussing this topic.

Which both conclude that it was only possible to either rename the _FILENAME (only moving the selected songs themselves) or _DIRECTORY (which renames/moves the directory in which the files reside, taking subfolders and other file types with it). Has someone found a way to move/rename the parent directory including all subfolders?

I'm planning to change my current folder structure for multi-disc albums from:


\album artist\album [CD 1]\tracknumber title.extension
\album artist\album [CD 1]\Artwork\Booklet.jpg
\album artist\album [CD 1]\Box Set Cover.jpg
\album artist\album [CD 1]\Cover.jpg
\album artist\album [CD 2]\tracknumber title.extension
\album artist\album [CD 2]\Artwork\Booklet.jpg
\album artist\album [CD 2]\Box Set Front.jpg
\album artist\album [CD 2]\Cover.jpg



\album artist\album\CD1\tracknumber title.extension
\album artist\album\CD1\Cover.jpg
\album artist\album\CD2\tracknumber title.extension
\album artist\album\CD2\Cover.jpg
\album artist\album\Artwork\Box Set Front.jpg
\album artist\album\Artwork\Booklet.jpg

To remove redundant images and declog the album folder level.

My current action to rename/move the album folder to my WIP folder is this:

I can change the first action to:

Format value:
Format string:
D:\rips\beets\$validate($regexp(%albumartist%,'^([^;]+)(;? ?)([\w ,-.]+)(.*)',$1$2$3),-)\$validate(%album%,-)\$ifgreater(%disctotal%,1,CD%discnumber%\,)

to achieve this change:
\album artist\album [CD 1]\tracknumber title.extension
\album artist\album\CD1\tracknumber title.extension

However, if I were to use that action on a folder that is already in my desired structure, it would only move the CD1 and CD2 folders and their contents. The "Artwork" folder on the same level would not be moved alongside.

Format value actions don't work for _PARENT_DIRECTORY and while this action:

Format value:
Format string:

does move the CD1, CD2 etc. folders to the desired new location within an existing file path, it also leaves behind the Artwork folder.

Has anyone found a workaround for this? I'd love to avoid having to manually move the Artwork folder and deleting the remnants.

You can only manipulate the current folder _DRECTORY (which is not the parent folder) to get a new name.
The only way around it would be to get all current folders onto the same level and rename from there.

Is there a technical reason for this that I'm not aware of? I'm curious why it's possible to move and rename the folder that the files reside in but not the parent of that folder.

I don't know.
I think that even in the Windows Explorer you cannot rename a folder without selecting it - which ist then more or less that what you see in _DIRECTORY.
Perhaps you can write a tool that uses command shell commands and see if that works

I'm looking into it. I don't know how exactly _DIRECTORY works in mp3-tag tho. My line of thinking was that you could simply run a regular expression over the output of _FOLDERPATH and then feed the output into whatever _DIRECTORY does with the folder. $regexp(%_folderpath%,(.*)\\.*\\.*\\,$1) for example.

And that would then rename only the _DRIECTORY part (which is the current one) and rename that single folder only - which is more or less what happens at the moment.

I'm aware. Hence my question if there is another way.
I did use

this line of thought to work out my action to reflect changes to %album%, %discnumber% and %subtitle% in a relative directory structure while maintaining the
%albumartist%\%album%\CD%discnumber% %subtitle%\
folder structure that I desire.

Format value:
Format string:
$if($neql($regexp(%_directory%,^(CD)\d+(\s.*)?,$1),CD),$regexp(%_folderpath%,(.*)\\.*\\,$1)\$ifgreater(%disctotal%,1,$validate(%album%,-)\CD$regexp(%discnumber%,(\d+)/\d+,$1)$if2( $validate(%subtitle%,-),),$validate(%album%,-)),$regexp(%_folderpath%,(.*)\\.*\\.*\\,$1)\$validate(%album%,-)\CD$regexp(%discnumber%,(\d+)/\d+,$1)$if2( $validate(%subtitle%,-),))

My next idea would be to call an outside program or script, pass that the %album% tag and the absolute path to the folder which I want it to rename IF %directory% is CD# etc., and rename this folder to %album% that way. I'd then use this after my action from above has already moved the CD1, CD2 etc. folders to that new folder (edit: this wouldn't work as the paths would already have changed by then). Hopefully that would achieve merging old and new folder and move any leftover files/folders (Artwork, Cover.jpg etc.) to the desired destination.

I'll update this if I make progress.

Even now you can rename the current folder so that it is merged with the folder above it or moved to any other location.
e.g. if you have
it is no problem to rename the CD1 folder to
If you do that with CD2 as well, then all the files from CD1 and 2 can be found in the folder
If you also have a folder
and you no rename
Abba\Arrival to
The you will also find
As the file that was the trigger of the action had
Abba\Arrival as _DIRECTORY renamed _DIRECTORY to getting\there.
And this included all the objects that where in that folder, including the pictures folder.

You workflow now would have to simplify the folder structure first, so that the baggage files and folders are on the same level as the audio files and then apply the target naming structure.

While that is true it defeats the purpose of the change that I want to make to my structure.
Currently I have the cover.jpg, back.jpg, booklet.jpg etc. all within each album folder or in a subfolder called Artwork so even my current action would move them along. edit: except for the few exceptions where the Artwork folder was so big that I put it on the album level instead as described further below.

While this approach works really well for single CD releases, it wastes a whole lot of storage for multi CD releases.

Depending on the size of the artwork I currently either have the entire artwork folder in every single subdirectory (which for a 10 CD release and 50MB of Artwork per CD means wasting 450MB of space for redundant information that adds 0 benefit or I have the Artwork folder at the same level as the album named %album% Artwork.
This saves space but isn't scanned by MusicBee (I can't add variables in the relative folder paths it scans for art).

My goal is to instead move the Artwork folder 1 level up and only leave a Cover.jpg and maybe Back.jpg in the sub directories of each disc, CD1, CD2 etc. (if they have different covers + backs on a per disc basis) and store the Artwork folder with the entire booklet etc. ONCE, no matter how many CDs there are in a release.

I can achieve the transition from

\album artist\album [CD1]\Artwork


\album artist\album\CD1\
\album artist\album\Artwork

The thing I'm trying to achieve is to move/rename all contents of that new folder structure when I change metadata without having to worry about Artwork folders that might get left behind.

I don't want to end up with

\King Crimson\Absent Lovvers\Artwork
\King Crimson\Absent Lovers\CD1
\King Crimson\Absent Lovers\CD1

after I correct the typo in "Lovvers" to "Lovers" in the album tag and run my action to move and rename, which I always do as a last step to ensure that metadata and folder structure remain in sync.
This would break the connection between the artwork folder and the actual music, defeating the purpose of having it in the first place.

If you first get all the files onto the same folder level with renaming the _DIRECTORY and then rename the FILES from there, you would create the subordinate folders.
To me the whole thing proves that any data collection that relies on single objects which then again should be grouped by some criteria should get as much embedded metadata as possible.
The way to spread the files for music, cd and pictures over several folders is bound to be hard to maintain as none of the objects "knows" that there are others that rely on this object and its place in a hierarchie.
I am a strong believer to embed as much metadata as possible - so that this object then becomes independend from all other objects.

I'd agree with you if I had a small to medium sized collection and/or multiple people with different levels of experience working on the files.

I like having huge art, scans of the entire booklet etc.. Sometimes 100+MB for a single Artwork folder. Embedding that would blow up my NAS. In its current form (no art whatsoever embedded but at least a Cover.jpg in every folder with 1000px+ if I could find it) my library takes up 18,6TB.
If I embedded all the art I could probably go and and buy a new NAS without gaining anything except for a minor ease of use. If a device needs embedded art I can let MusicBee embed it while exporting in any size I want on the fly.

I'm aware of the caveats that a structure like the one I plan to use brings with it. For my library size it is worth the "risk" in my opinion tho (and I hate storing stuff multiple times if I don't absolutely need to - backups excluded ofc).
With the action capabilities of mp3-tag I can automate/script enough of it to minimize the likelihood of errors. As long as I ensure that the metadata is correct, everything should fit snugly in it's designated place. And if I make a mistake I have a month worth of 2 snapshots per day + 2 dedicated backups of everything.

Also this would not work for me as I have many files with different content but the same names in the current directories. Cover.jpg in a boxset of 5 original albums by "If" for example is the original album cover of each album. Each disc has its own directory currently and has to remain this way unless I want a few thousand headaches.

Since no one else came up with a solution or workaround I've created one myself.

If anyone else wants to take a stab at it or has suggestions for improvement, here's the batch file I use:

cd ..\..
@IF [%1]==[] exit /b
@IF [%2]==[] exit /b
ren %1 %2

I've added this .bat as a tool to mp3tag with these parameters:

$if($and($eql($regexp(%_directory%,^(CD)\d+(\s.*)?,$1),CD),$neql(%_parent_directory%,$validate(%album%,-))),"%_parent_directory%" "$validate(%album%,-)",)

It checks if the directory starts with "CD#" and also if %_parent_directory% is not equal to the value of $validate(%album%,-) and only then passes %_parent_directory% and $validate(%album%,-) as 2 arguments to my batch file which then renames the parent directory to $validate(%album,-).

While this does achieve what I want, the downside is that mp3tag is not aware of the changed directory name until I hit F5 to rescan/reload the working directory.
And I have to use this tool before I use my other action which moves the CD1, CD2 etc. subdirectories (to resemble a change in the %album% tag) for it to work.
Also: it currently only works for 1 album at a time. If you check: "for all selected files" in the tools options it will rename the directory for the first selected track and you are left with error windows for the rest of the tracks in the subdirectories of that parent folder.

If you filter before using the tool:

%_tag_read% IS flac AND %track% IS 1 AND %discnumber% IS 1

you can run it over all the flac results with "for all selected files" checked in the tool options as there is only one disc 1 track 1 song in every multi disc parent folder so there are no conflicts with multiple cmd windows trying to access the same folder or trying to rename a folder that is no longer there.

I still don't understand why it's not possible to change the value of %_parent_directory% from within mp3tag and would love to see this functionality as a feature.