Is there a way to batch rename the filename?

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

I was editing this when you made your post.

Hello again. I need your help ZvezdanD. You created a script for me the other day. I really like it. I want to tweak it a little by changing the brackets's to parentheses. I tried to do this on my own but I think I just messed things up. Seemed staight forward. I just replaced the brackets to parentheses. (.+?)\\(.+)\\((^\\)+)\.((^\.\\)+)$ When I discovered it didn't do what I planned, I tried to change it back to (.+?)\\(.+)\\([^\\]+)\.([^\.\\]+)$ but it doesn't seem to want to change back. I deleted the custom script and recreated it. All okay. Please see "Replacement" adds a dash between to Chicago and 40th. It should be a :. The file actually shows as Chicago - The Best Of Chicago: 40th Anniversary Edition. I would like to have it exactly how the "Title" reads, if it can't be that way then remove that dash that script is adding. I really would like : next to Chicago but I don't know how that would work out with titles that don't need the : . I f there has to be a choice, eliminate the dash and leave a single space.

<Artist> - <Album> <Disc#> - <Track#2> - <Title>

How it is now:

Chicago - The Best Of Chicago 40th Anniversary Edition- 10 - (I've Been) Searchin' So Long.mp3

What I want it to be:

Chicago - The Best Of Chicago: 40th Anniversary Edition - 10 - (I've Been) Searchin' So Long.mp3

<Artist> - <Album> <Disc#> - <Track#2> - <Title>

2 digit for <Track#2>
Just a space between <Album> <Disc#>


Please help. Thanks.

http://img408.imageshack.us/my.php?imag ... 41009f.jpg
Last edited by steviegt on Fri Apr 10, 2009 8:44 am, edited 6 times in total.
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

steviegt wrote:1. Has nothing to do with functionality.....why did the color change from yellow to blue once I made the change to the parentheses?
Yellow background have only tracks which would have different content after replacement then before, i.e. source field would be changed if you click on the Replace button.
2. I know you previously said something about disc #'s so forgive me for asking for clarity. See the example #2 shows the "Result" having disc # appearing twice. Once because I included it in the Title name, and once because I populated the disc # field on the tag. Once I tweaked the script for the brackets, and I removed the disc # from the Title and left the Disc # field populated, the "New Path" and end result doesn't show the disc # at all. What did I do?
Sorry, but I cannot see too much from your screenshots. It could be better if you post your Replace with string if you changed it.
3. See example #1. Why doesn't the Replacement, Result & New Path match? Also see "Replacement" still shows brackets, not parentheses?
The Replacement don't need to be same as Result, if they are always same I could remove that area from the dialog box or use it for something another. The Replacement field is most notable with presets that have the Regular expression 2 turned on, then it displays if the From field is matched with the Replace with string.

The Result and the New Path should be same and maybe you discovered some bug in script. Please post your Replace with string and values for all included fields for that track (Artist, Album, Title...).
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

Please see my revised post below. I was editing when you replied. :D
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Sorry, but I still don't understand what you want. Here are just two suggestions. The first thing - you should not change Find what string. Parentheses which it contains are not ordinal parentheses, but regular expression symbols and you could not replace them with brackets. If you want to add/remove parentheses in the path or to replace them with brackets, you should modify the Replace with string.

The second thing - you cannot add ":" to the Path - this is not allowed DOS/Windows character for filename. The SDB.Tools.FileSystem.CorrectFilename function which I am using in my expression would remove that character automatically.

Please post your Replace with string if you modified it and an example of the file path which you want to get. The Replace with string which I give you before should work correctly with your first filename example that you specified on the begin. Here is a version that have replaced brackets with parentheses for the Disc number:

Code: Select all

"C:\Users\Steve\Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.ArtistName & " - " & oSongData.AlbumName & IIf(Len(oSongData.DiscNumberStr) > 0, " (Disc " & oSongData.DiscNumberStr & ")", "") & " - " & Right("0" & oSongData.TrackOrderStr, 2) & " - " & oSongData.Title) & ".$4"
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Just to mention if you don't know already - MM has a table of replacements for characters that are not allowed with DOS/Windows which is under the FilenameMappings section of the MediaMonkey.ini file (c:\Documents and Settings\your_username\Local Settings\Application Data\MediaMonkey\). Characters are represented with their hexadecimal code, ":" is 3A and default replacement for it is "-" which is 2D. So, if you want to replace default character for replacement, for example you want to replace ":" with a space and dash (" -"), you should enter 3A=202D.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

This is the current replace string.

"C:\Users\Steve\Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.ArtistName & " - " & oSongData.AlbumName & IIf(Len(oSongData.DiscNumberStr) > 0, " [Disc " & oSongData.DiscNumberStr & "]", "") & " - " & oSongData.TrackOrderStr & " - " & oSongData.Title) & ".$4"

Take notice below, I have removed the :. I changed the Disc # to make it a seperate entry read from the tag Disc # field instead of being part of the Title.

Since the : is not possible, I would like to eliminate the - that is being substituted for that character and format as shown below. The Best Of Chicago - 40th Anniversary Edition is all part of the Title. - Disc 1 - is a change.

This is how I want it to look:

C:\Users\Steve\Music\Chicago - The Best Of Chicago - 40th Anniversary Edition - Disc 1 - 10 - (I've Been) Searchin' So Long.mp3
I hope this makes sense. Thanks.
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Please post your exact data for the mentioned track:
Artist=
Album=
Title=
Track #=
Disc #=
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

Chicago - The Best Of Chicago - 40th Anniversary Edition - Disc 1 - 10 - (I've Been) Searchin' So Long.mp3

Can you do an "If" statement for when there is no Disc #, then the field in the filename should not be used as shown below.

Chicago - The Best Of Chicago - 40th Anniversary Edition - 10 - (I've Been) Searchin' So Long.mp3

Artist
Album
Disc #
Track #
Title

I will stop using the : so that will resolve that issue.
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Are you sure that those colored text are your data from database which I asked for? I am not asking for parts of existing filename, but for mentioned fields inside of the database. The Replace with script which I posted already have IIf function for displaying of Disc Number field. If this field is empty then that part would not be stored in the file name:

Code: Select all

IIf(Len(oSongData.DiscNumberStr) > 0, " (Disc " & oSongData.DiscNumberStr & ")", "")
Do you have your tracks scanned and stored into database at all or you just want to rename some audio files which are not inside of database?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

I am truly sorry. It's going over my head. From what database do you want this info from? :oops: Is this what you need?

"C:\Users\Steve\Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.ArtistName & " - " & oSongData.AlbumName & IIf(Len(oSongData.DiscNumberStr) > 0, " [Disc " & oSongData.DiscNumberStr & "]", "") & " - " & oSongData.TrackOrderStr & " - " & oSongData.Title) & ".$4"
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Did you use the File / Add/Rescan Tracks to the Library option at all?

If you select mentioned track in the main tracklist of MM and choose Edit / Properties, what you see for mentioned fields (Artist/Album...)?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

All of my files are in the MM database.

File Path: C:\Users\Steve\Music\Chicago - The Best Of Chicago - 40th Anniversary Edition [Disc 1] - 10 - (I've Been) Searchin' So Long.mp3
Filename: Chicago - The Best Of Chicago - 40th Anniversary Edition [Disc 1] - 10 - (I've Been) Searchin' So Long.mp3
Track title: (I've Been) Searchin' So Long
Artist: Chicago
Genre: Soft Rock
Album: The Best Of Chicago - 40th Anniversary Edition
Album artist: Chicago
Disc #: 1
Track #: 10
Date: 2007

http://img509.imageshack.us/my.php?imag ... rtiesv.jpg
Last edited by steviegt on Fri Apr 10, 2009 11:47 am, edited 1 time in total.
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

OK, fine. But now I don't see where is a problem. Maybe you don't want to store information about disc number if it is = 1, right? If this is a case then you could try with the next Replace with string:

Code: Select all

"C:\Users\Steve\Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.ArtistName & " - " & oSongData.AlbumName & IIf(Len(oSongData.DiscNumberStr) > 0 And oSongData.DiscNumberStr <> "1", " (Disc " & oSongData.DiscNumberStr & ")", "") & " - " & Right("0" & oSongData.TrackOrderStr, 2) & " - " & oSongData.Title) & ".$4"
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

The difference is I have (want to) remove the parentheses all together from the Disc #. Also, following the Title, I want a space, then a dash, then a space, then the Disc # etc...

You are a kind and patient person. I won't bother you again after this. :D
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
ZvezdanD
Posts: 3157
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Oh well, on the top of this page you wrote "I want to tweak it a little by changing the brackets's to parentheses." and I gave you a string for that. Just now I see that you don't need brackets at all. Here is a string which don't have parentheses nor brackets around the Disc number, but it has dashes before and after:

Code: Select all

"C:\Users\Steve\Music\" & SDB.Tools.FileSystem.CorrectFilename(oSongData.ArtistName & " - " & oSongData.AlbumName & IIf(Len(oSongData.DiscNumberStr) > 0, " - Disc " & oSongData.DiscNumberStr, "") & " - " & Right("0" & oSongData.TrackOrderStr, 2) & " - " & oSongData.Title) & ".$4"
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
Post Reply