move files to parent folder & rename that folder in one actiongroup


#1

Is it possible to move files to parent folder & rename that folder in one actiongroup?
I have tried different approaches, but all atempts created a new folder and left the parent folder as an empty folder.

example:

situation:
music\parent folder\folder\file.mp3

goal:
music\folder\file.mp3

my attempts:
music\folder\file.mp3
music\parent folder\

For documentation and discussion, two action groups which left the an empty parent folder:

first try:

Begin Action Group &Ordner Umbenennen#Überordner &weglassen

Action #1
Actiontype 5: Format value
Field ______: _DIRECTORY
Formatstring: ..\%_directory%

End Action Group &Ordner Umbenennen#Überordner &weglassen (1 Action)

second try:

Begin Action Group &Ordner Umbenennen#Überordner weglassen (&1)

Action #1
Actiontype 5: Format value
Field ______: FOLDERNAME TEMP
Formatstring: %_directory%

Action #2
Actiontype 5: Format value
Field ______: _DIRECTORY
Formatstring: .</b>

Action #3
Actiontype 5: Format value
Field ______: _DIRECTORY
Formatstring: %FOLDERNAME TEMP%

Action #4
Actiontype 9: Remove fields
Fields to remove (semicolon separated): FOLDERNAME TEMP

End Action Group &Ordner Umbenennen#Überordner weglassen (&1) (4 Actions)


#2

I doubt that this will work with a relative path but I have tested it with an absolute path.
So if you enter e.g.
D:\Marktplatz\%album%
as _DIRECTORY value then the old directory gets moved and no empty directory is left over.

(I am not sure: but if you use the Format Value action, it takes the parameters of the first file and all the rest is then moved to the new location so that the relative path is no longer valid ... just a guess)


#3

This would also work with relative pathes with some regex path transformations, but it would left the parent folder untouched. I search for a solution which combines parent folder and folder into one folder and renames that folder to the name of the original folder.

Yes, it's always the parameters of the first file, but that's no problem for me, all my folder are album based, the relevant parameters are identical for all files.


#4

Just an observation: if you create 2 columns, one with the value %_parent_directory% and one with the value "..\%_directory" then you see 2 different folder names - instead of one.
So it could be that you would have to use the actual value for _PARENT_DIRECTORY instead of an indirect description.
So if you used both, sort of, get the relative parent directory but format the value with an absolute path ...


#5

I don't think Mp3tag ever actually "removes" any folders. It either renames the folder, or else it moves files to a different folder. Only when it renames the original folder does it appear to remove the old one.

You'll note that if you have a folder of files and change the folder name (keeping it in the same place in the folder tree) of just one file, all files end up in that folder. Mp3tag is actually renaming the folder, not creating a new folder, moving the files and removing the old folder. But when the folder is at any other level, Mp3tag moves the files and the original folder remains.


#6

I think you are right. Mp3tag doesn't remove folders. But it can merge two (or more) folders into one folder, thus acctually reduce the number of folders.
But when I can't rename that folder (ex parent folder) in the same action group.

However, I can reach my goal, if I split it into two action groups:

Begin Action Group &Ordner Umbenennen#Überordner weglassen (step &1)

Action #1
Actiontype 5: Format value
Field ______: FOLDERNAME TEMP
Formatstring: %_directory%

Action #2
Actiontype 5: Format value
Field ______: _DIRECTORY
Formatstring: .</b>

End Action Group &Ordner Umbenennen#Überordner weglassen (step &1) (2 Actions)

Begin Action Group &Ordner Umbenennen#Überordner weglassen (step &2)

Action #1
Actiontype 5: Format value
Field ______: _DIRECTORY
Formatstring: %FOLDERNAME TEMP%

Action #2
Actiontype 9: Remove fields
Fields to remove (semicolon separated): FOLDERNAME TEMP

End Action Group &Ordner Umbenennen#Überordner weglassen (step &2) (2 Actions)

My goal was to reach that with one action group and without temporary tag fields. But I think it's not possible


#7

Just as a matter of nit-picking:

if you have a folder structure
a\b\c

then "c" is the contents of _DIRECTORY.
If you enter a string
"..\%_Directory%"
then you go up one level (="b") and create a folder "c" - and that is more or less the current structure.
if you want do manipulate the level "b" and mov "c" there then you would have to go up 2 levels:
....\%_directory%
So perhaps this is the problem?