Problems editing folders

Bulk Rename Utility How-To's

Problems editing folders

Postby GTinOZ » Sat Mar 20, 2021 5:33 am

I have a very large number of music files, theoretically all filed in folders \[Album Artist] - [Album]\
However, a program I recently ran reorganized some of the music (with rules/patterns I can't distinguish) so that tracks within some (not all) albums were divided into two folders:

one marked \[Album Artist] - [Album]\ as originally, and
another marked \[Album Artist] - [Album]_1\

I tried to use BRU to remove the '_1' from the end of the second folder, assuming that that would result in combining the original folders into one folder, with all the tracks, but can't get it to work.

I used the filter "*_1" to select those folders, and then tried to modify the folder names by two different processes:

Using 'Replace (3) to replace '_1' with nothing, and
Using Remove (5) to remove the last 2 digits.

In both cases it says that it is working, showing the correct new name in green and then, when I press 'Rename', showing me the warning '34 files and/or folders etc' then it appears to do it, but doesn't.

Any thoughts?
GTinOZ
 
Posts: 3
Joined: Sat Mar 20, 2021 5:17 am

Re: Problems editing folders

Postby GTinOZ » Sat Mar 20, 2021 5:58 am

I had a thought and checked in case the same file was in each folder - i.e. setting up a clash when it tried to combine the folders - and that was true a few times, but not in the majority (so far)
GTinOZ
 
Posts: 3
Joined: Sat Mar 20, 2021 5:17 am

Re: Problems editing folders

Postby Luuk » Sat Mar 20, 2021 9:24 am

Greetings, the BRU will always forbid renaming folders to any foldername that does already exist.
Also, the Filters(12) "Mask" can only match filenames or foldernames, but not "\parent-foldername\filename".

But with the paid version, there is Filters(12) "Condition" to also match files by the parent-foldername.
Im not expert to know the javascript, but did see on another post that conducts like your explanation.
So its definitely possible, but Im just not finding the post right now.

If nothing else, I can post exiftool solution if we cannot find the javascript solution.
The format was something like... /RegEx/.test(folder)
Luuk
 
Posts: 700
Joined: Fri Feb 21, 2020 10:58 pm

Re: Problems editing folders

Postby Luuk » Sun Mar 21, 2021 10:39 pm

Sorry, but Im still not finding the javascript example, but the exiftool does it like...
Code: Select all
exiftool -r -fast4 -ext * -if "$Directory =~ /\[.+\] - \[.+\]_1$$/" -Filename"<${Directory;s/..$//}/%f%-c.%e" .
It recursively finds folders like "[Start] - [End]_1" and moves all the files inside like your explanation.
Except if the same filename is already there ahead of time, it will suffix -1, -2, etc to invent a unique name.
But its also safe like BRU, because never deleting any folders or files for safety, but creating the folder names if needed.


If you like a batch that also deletes the empty folders...
Code: Select all
@echo off
cd /d "F:\Folder-Path"
exiftool -r -fast4 -ext * -if "$Directory =~ /\[.+\] - \[.+\]_1$$/" -Filename"<${Directory;s/..$//}/%%f%%-c.%%e" .
FOR /d /r %%A IN ("[*] - [*]_1") do RD /s /q "%%A"
pause
Just change your correct "F:\Folder-Path" and then save it all into a .bat file, then put exiftool.exe inside your Windows folder.
So this lets you click the batch to move all the files, then deleting any of the empty folders.
If I can find the similiar javascript solution, I will come back to post the link.
Luuk
 
Posts: 700
Joined: Fri Feb 21, 2020 10:58 pm

Re: Problems editing folders

Postby GTinOZ » Fri Mar 26, 2021 7:11 am

Thanks Heaps luuk - I'll find some time in the next few days to give this a go and let you know.
GTinOZ
 
Posts: 3
Joined: Sat Mar 20, 2021 5:17 am

Re: Problems editing folders

Postby Luuk » Fri Mar 26, 2021 10:48 am

To be safe, please remove /s /q from the RD command.
This way, it can only delete the empty folders. Its safe to follow the instructions, but any mistakes could delete the _1 folders.
Removing the /s /q will make it impossible to delete any folders unless they are empty, even if there is mistakes.
Luuk
 
Posts: 700
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To