Moving non-audio files when renaming based on tags


#1

I am amazed and delighted with what mp3tag can do for me. It is making re-organising my collection very easy, and the scripting is both logical and powerful.

I've hit a problem though. I also have non-audio data in my "audio" folders, like cover art, rip logs, and sometimes other notes. I want to move these along with the audio content.

I've found this thread...
/t/570/1
...which describes using the _DIRECTORY field to rename folders. However, my re-organisation seems a little too radical for straight renaming of folders to work. In some cases I'm combining the contents of two folders, in others I'm splitting the contents of one, and in every case I'm re-writing the entire path right up to the drive letter.

e.g. I've been playing around with this tag>file mapping...
D:\audio\2$if($eql(%genre%,Vintage),Vintage,$if($eql(%genre%,Classical),Classical,$if($eql(%genre%,Christmas),Christmas,$if($eql(%genre%,Childrens),Children''s Music,$if($eql(%genre%,Speech),Books and Spoken Word,All in HERE except)))))$if($or($or($eql(%genre%,Vintage),$eql(%genre%,Classical)),$eql(%genre%,Christmas)),$if(%compilation%,_compilations,),$if($or($or($eql(%genre%,Childrens),$eql(%genre%,Speech)),$eql(%genre%,Soundtrack)),,$if(%compilation%,_compilations,)))$if(%compilation%,,$if($or($or($or($eql(%genre%,Vintage),$eql(%genre%,Classical)),$eql(%genre%,Christmas)),$eql(%genre%,Speech)),%albumartist%,$if($or($eql(%genre%,Childrens),$eql(%genre%,Soundtrack)),,%albumartist%)))%album%$ifgreater(%disctotal%,1,$if($neql($strstr('('disc ,%album%),0),,$ifgreater(%disctotal%,9,$num(%discnumber%,2)-,%discnumber%-)),)$num(%track%,2). $if($and($eql(%genre%,Classical),compilation),%artist% - ,)%title%$if($and($and(%compilation%,$neql(%genre%,Classical)),%artist%), - %artist%,)$if($or($or($or(%compilation%,$eql(%genre%,Classical)), $eql(%genre%,Speech)),$eql(%genre%,Childrens)),,$if($and(%albumartist%,%artist%),$if($neql(%albumartist%,%artist%), - %artist%,),))

I know it's inefficient in places - I wrote it as I was learning mp3tag - but it's quite close to what I what to do.

How can I take something like that, and move non-audio files along with the audio files?

(I'm using FLAC, if that's relevant. The mp3 copies just mirror the FLAC organisation).

Many thanks for any help anyone can give!

David.

P.S. I bet I'll want to re-organise everything again in a few years when I've seen how this latest organisation works out. This is easy enough if the tags are "right" by using tag>filename - but it means the fix for the non-audio files probably won't be a "once and for all" fix, but one that needs doing again.


#2

If you modify the filename then you can also move the file (as you have experienced).
This method treats every file individually.

The good thing about this method is that you can create a new structure from unstructured collections.
But: this method treats only files with tags.
If your non-audio files do not show the same kind of tags it does not work.
also: this method leaves empty folders if all files have been moved to the new location.

If you want to move the whole container and all that is in it (including the non-audio files) then rename the folder.
The new folder name can be constructed from the tag of the first (audio) file in the folder.
The method leaves the number of folders as it is, it only renames them.

So you have to find, if your workflow allows it to first locally rename files without tempering with the folder structure and then rename the folders.

For the renaming of files use the converter Tag-Filename but do not apply any path information.
For the renaming of folders use the action "Format value" for _DIRECTORY.

The only exception to this rule is that you can rename a non-audio file with the converter Tag-Filename if the new filename can be constructed from parts of the path information.

The example you supplied suggests that with the current workflow it is not possible to move the non-audio files.


#3

Yes, the intent was to move everything over to a new path (hence the "/2/" in the above), leaving all the old folders empty and ready to delete.

I am still digesting everything else you wrote. I think it might be possible to do what you say: rename files, then move folders, with both separate steps based on the tag information. It'll double the amount of work required to script it, but as long as it's automatic when finished that's a small price to pay.

Hang on: It might need three steps. In some cases, I'm taking disc 1 and disc 2 and putting them into a single folder with discnumer-tracknumber filenames. If I try to rename both old folders to the same new name, one will fail, won't it? I guess I can manually or automatically copy the ALL files from the old disc 2 folder to the old disc 1 folder after the filename renaming, before the folder renaming and it'll be find.

Thank you. I think I see a way through this now! I'll come back if I get stuck.

Cheers,
David.


#4

If you have a folder
bring on the the night CD1
and another
bring on the the night CD2
(both with the same folder depth)
You can rename the CD1 folder to:
bring on the the night
and then
the cd2 folder also to
bring on the the night
This would then move all files to the same folder.

The important bit is: you have to have already the correct amount of folders . If you want to have more, then it won't work.
If you can join folders then it is ok.


#5

Thank you so much for your help ohrenkino.

actions > actions > new > (enter name) > new > Format Value
Field = _FILENAME
Format String = the second half of what I had before

...then...

new > Format Value
field = _DIRECTORY
Format String = the first half of what I had before

...gives me a single click action that does exactly what I was doing before, but moves all the non-audio files too. As you said, folders can be joined without a problem (any duplicate filenames in the two folders cause a normal windows file overwrite warning to be displayed). You can't split folders this way, but I don't need to do this at the moment. My previous method would happily split folders, so I guess I can add that as a third step if ever needed.

Many thanks again.

David.
P.S. no idea where that link in my first post came from. It should have been...
/t/14613/1
...which is a current thread discussing almost the same thing, but I did not understand how it was relevant until you explained that it would work for what I was trying to do.


Wie nur Ordner ohne Unterordner umbenennen?