My file renaming script

This is still a work in progress. There are still some things that I’m trying to figure out.

You’ll be able to edit the very bottom of the script to your liking.

$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
			$set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
			$set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
			$set(MainFolder3,)
			$set(Artist1,$replace($rreplace(%albumartist%,%artist%[_:], -),?,)/)	
			$set(Artist2,$replace($rreplace(%albumartistsort%,[_:],-),?,)/)
			$set(Album1,$replace($rreplace(%album%,[_:], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
			$set(Album2,$replace($rreplace(%album%,[_:], -),?,)/)	
			$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/))
			$set(MultiDisc2,)
			$set(Title1,$replace($rreplace(%albumartist% ,[_:],-),?,)- $replace($rreplace(%album%,[_:], -),?,) - $num(%tracknumber%,2) - $replace($rreplace(%title%,[?_:],),?,))
			$set(Title2,$replace($rreplace(%albumartist% ,[_:],-),?,) - $replace($rreplace(%album%,[_:], -),?,) - $num(%tracknumber%,1) - $replace($rreplace(%title%,[?_:],),?,))
			$set(Title3,$num(%tracknumber%,2) - $replace($rreplace(%title%,[?_:],),?,))
			$set(Title4,$num(%tracknumber%,1) - $replace($rreplace(%title%,[?_:],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS BE JUST BELOW *** )


$noop(*** EDITABLE AREA BELOW | CHANGE ONLY THE NUMERCAL VALUE ONLY! ***)
	$noop( The following will use 'The Beatles' as an example. )

	$noop( Option 1 or 2 - Create a single character folder. Option 3 - no single character will be used. )
		%MainFolder1%		$noop( OPTION 1 -= T=- | OPTION 2 -= B =- | OPTION 3 = No single character folder will be created.)
		%Artist1%				$noop( OPTION 1 = The Beatles | OPTION 2 = Beatles, The )
		%Album1%				$noop( OPTION 1 = Help! [1965] | OPTION 2 = Help! )
		%MultiDisc1%			$noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder.)
		%Title1%				$noop( OPTION 1 = The Beatles - Help! - 07 - Ticket to Ride | OPTION 2 = The Beatles - Help! - 7 - Ticket to Ride | OPTION 3 = 07 - Ticket to Ride | OPTION 4 =  7 - Ticket to Ride )
3 Likes

Thanks for sharing this. It does exactly what I wanted.
TIL: I’m a 3,1,1,4 :slight_smile:

Here’s the updated version. This one adds a option for the track number. So if you don’t want it in a multi disc format, then you may want to change the track number. By default it’s 01, but if no multi disc option is set %MultiDisc2%, then you can set %Track2% and this would output 1-01, for disc 2 it would be 2-01, etc.

$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
			$set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
			$set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
			$set(MainFolder3,)
			$set(Artist1,$replace($rreplace(%albumartist%,[_:*?"<>|],-),?,)/)
			$set(Artist2,$replace($rreplace(%albumartistsort%,[_:*?"<>|],-),?,)/)
			$set(Album1,$replace($rreplace(%album%,[_:*?"<>|], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
			$set(Album2,$replace($rreplace(%album%,[_:*?"<>|], -),?,)/)
			$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
			$set(MultiDisc2,)
			$set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))
			$set(PreTitle2,)
			$set(Track1, $num(%tracknumber%,2) - )
			$set(Track2, $num(%discnumber%,1)-$num(%tracknumber%,2) - ))
			$set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS JUST BELOW *** )




$noop( *** The Following will use the example of artist: Amy Winehouse and album: Back to Black *** )
$noop( *** Default output: -=A =-/Amy Winehouse/Back to Black [2007]/Disc 1/Amy Winehouse - Back to Black - 01 - Rehab *** )
$noop( *** Change the NUMERICAL value ONLY! Example: %MainFolder1% would be changed to %MainFolder2% *** )
$noop( *** Only change the numerical value to either 1 or 2, anything else will mess things up. *** )
%MainFolder1%	$noop( OPTION 1 -= A=- | OPTION 2 -= W =- | OPTION 3 = No single character folder will be created. )
%Artist1%			$noop( OPTION 1 = Amy WineHouse| OPTION 2 = Winehouse, Amy )
%Album1%			$noop( OPTION 1 = Back to Black [2007] | OPTION 2 = Back to Black )
%MultiDisc1%		$noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder. )
%PreTitle1%		$noop( OPTION 1 = Show Artist and Album in the track title | OPTION 2 = Do not display Artist or Album)
%Track1%			$noop( OPTION 1 = Track Number: 01 | OPTION 2: Track Number: 1-01-> This is best if MultiDisc is set to 2, because you will have 2 track numbers as 01 - *track names*, etc. )
%Title%				$noop( NO OPTION - Just display the name of the track. )
1 Like

could you make this script with out various artist?

Sorry I haven’t played with this script for awhile. But I added the ability to remove Various Artists. Read the very bottom of the script to see how. This should be done on those albums ONLY.
Basically it grabs the info and would put it into that artists folder, with just the name of the track.

	$noop( *** DO NOT EDIT THE AREA BELOW | EDITABLE AREA WILL BE AT THE VERY BOTTOM *** )
	$set(MainFolder1,-= $upper($left(%albumartist%,1)) =-/)
	$set(MainFolder2,-= $upper($left(%albumartistsort%,1)) =-/)
	$set(MainFolder3,)
	$set(MainFolder4,-= $upper($left(%artist%,1)) =-/)
	$set(MainFolder5,-= $upper($left(%artistsort%,1)) =-/)
	$set(Artist1,$replace($rreplace(%albumartist%,[_:*?"<>|],-),?,)/)
	$set(Artist2,$replace($rreplace(%albumartistsort%,[_:*?"<>|],-),?,)/)
	$set(Artist3,$replace($rreplace(%artist%,[_:*?"<>|],-),?,)/)
	$set(Artist4,$replace($rreplace(%artistsort%,[_:*?"<>|],-),?,)/)
	$set(Album1,$replace($rreplace(%album%,[_:*?"<>|], -),?,)$if(%date%,$if(%album%, )[$left(%date%,4)])/)
	$set(Album2,$replace($rreplace($if(%date%,$if(%album%, )[$left(%date%,4)] )%album%,[_:*?"<>|], -),?,)/)
	$set(Album3,$replace($rreplace(%album%,[_:*?"<>|], -),?,)/)
	$set(Album4,)
	$set(MultiDisc1,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
	$set(MultiDisc2,)
	$set(PreTitle1,$replace($rreplace(%albumartist% - %album% -,[_:*?"<>|], -),?,))
	$set(PreTitle2,)
	$set(Track1, $num(%tracknumber%,2) - )
	$set(Track2, $num(%discnumber%,1)-$num(%tracknumber%,2) - ))
	$set(Track3,)
	$set(Title,$replace($rreplace(%title%,[_:*?"<>|],),?,))
$noop( *** DO NOT EDIT THE AREA ABOVE| EDITABLE AREA IS JUST BELOW *** )




$noop(
*** The Following will use the example of artist: Amy Winehouse and album: Back to Black *** 
*** Default output: -=A =-/Amy Winehouse/Back to Black [2007]/Disc 1/Amy Winehouse - Back to Black - 01 - Rehab ***
*** Change the NUMERICAL value ONLY! Example: %MainFolder1% would be changed to %MainFolder2% ***
*** Only change the numerical value to either 1 or 2, anything else will mess things up. *** )

%MainFolder1%	$noop( OPTION 1 -= A=- | OPTION 2 -= W =- | OPTION 3 = No single character folder will be created. )
%Artist1%			$noop( OPTION 1 = Amy WineHouse| OPTION 2 = Winehouse, Amy )
%Album1%			$noop( OPTION 1 = Back to Black [2007] | OPTION 2= [2007] Back to Black  | OPTION 3 = Back to Black )
%MultiDisc1%		$noop( OPTION 1 = If album has more than 1 Disc, then add Disc folders | OPTION 2 = Do not sort by Disc, put all files into a single folder. )
%PreTitle1%		$noop( OPTION 1 = Show Artist and Album in the track title | OPTION 2 = Do not display Artist or Album)
%Track1%			$noop( OPTION 1 = Track Number: 01 | OPTION 2: Track Number: 1-01-> This is best if MultiDisc is set to 2, because you will have 2 track numbers as 01 - *track names*, etc. )
%Title%			$noop( NO OPTION - Just display the name of the track.

Want to remove Various Artists - then do the following.
Should be done on those albums ONLY!
Change %MainFolder1% to either  3 or 4. Sorts by artist and not album artist.
Change %Artist1% to either 3 or 4. Sorts by artist and not album artist.
Change %PreTitle% to 2. Removes the artist name and album name from the track name.
Change %Track1% to 3. This removes the track number from the track name.)