mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2003
Posts: 5
X
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
X
Joined: Jun 2003
Posts: 5
I'm trying to re-name my karaoke files. they are zipped files and I need to rename them to artist - song.zip The problem is they are mostly in the format

cb60373-01 Kenny Chesney - When The Sun Goes Down.zip

I'd like them re-named to

Kenny Chesney - When The Sun Goes Down(CB).zip

Then I can find by artist alot easier, and I can also create a list with arists so people can look at my disc book, and my hard drive list, but it's too hard tomake a list in it's current state. I'd do it manually, but I have 30,000 songs. I don't have that kind of time. It would take weeks to cycle through all the files, and re-name them.

if ($file($left,2) == CB) $rename($file($remove($1,$file $+ (CB) $+ .zip)
??? Would that work?

Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
Without knowing exactly how the files are named, any code I could give you would probably not function as intended.

cb60373-01 Kenny Chesney - When The Sun Goes Down.zip

They all being with cb followed by 5 numbers then a dash then two more numbers? If so, then this is fairly easy to do. If not, it would be more work but still doable as long as there is some type of pattern to it.

Edit: Assuming the above is true, you'd could use something like...

Pseudo-code
Code:
test file to make sure its something you want to change
set a variable to capture everything but the first token
replace .zip with (CB).zip
rename the file to the variable

Last edited by Thrull; 13/09/09 01:48 AM.

Yar
Joined: Jun 2003
Posts: 5
X
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
X
Joined: Jun 2003
Posts: 5
what about just taking the one's labeled by a disc type and just taking the entire disc code and putting it on the end instead.

example: cb60373-01 Kenny Chesney - When the sun goes down.zip

becomes: Kenny Chesney - When the sun goes down(cb60373-01).zip


Joined: Aug 2006
Posts: 183
T
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 183
Originally Posted By: XcALiBrE
what about just taking the one's labeled by a disc type and just taking the entire disc code and putting it on the end instead.

example: cb60373-01 Kenny Chesney - When the sun goes down.zip

becomes: Kenny Chesney - When the sun goes down(cb60373-01).zip


Sure...

Untested
Code:
var %filename filename
var %filename.tok1 $gettok(%filename,1,32)
var %filename.rem $remove(%filename,%filename.tok1)
var %filename.output $replace(%filename.rem,.zip, $chr(40) $+ %filename.tok1 $+ $chr(41) $+ .zip)
rename %filename %filename.output


You'll need to test to see if the file exists and if you want to change it. It'd be a good idea to run a test on copies of files in another directory before actually running the script on the actual directory. And finally, BACK UP all your files in another directory first... Just in case something goes terribly wrong.


Yar

Link Copied to Clipboard