My file renaming script


#1

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 )

#2

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


#6

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. )

#7

could you make this script with out various artist?