Page 1 of 1

N00b: Underscore Clearing Script.

Posted: June 14th, 2010, 12:58 pm
by ChrisiB
Hi,

I've looked at the wiki and searched the manual but I can't seem to find a way of removing the _ in filenames.

I want e.g. "I_Love_This_Film_(2009)[1]" to be replaced with "I Love This Film (2009)"

Any ideas would be helpful, thank you

Re: N00b: Underscore Clearing Script.

Posted: June 14th, 2010, 3:33 pm
by doubledrat
pc or linux?  what exactly do you want the _ removed from?  filenames?  directories?

Re: N00b: Underscore Clearing Script.

Posted: June 15th, 2010, 5:08 pm
by ChrisiB
This will be for PC using Win 7.

I have just come from ALTbinz and it used to replace all the underscores, I prefer the collection with spaces as it looks neater.

I notice I wrote filenames in the previous, but what i meant was the folder name, i.e. the name of the NZB therefore my example was the name of the folder before and after sorry.

thanks

Re: N00b: Underscore Clearing Script.

Posted: June 16th, 2010, 10:37 am
by doubledrat
well.  If you have a single level directory structure and the name of the directory is the same as the name of the nzb you can do this

Code: Select all

REM root will be different for you
set root=C:\mydownloads\linux
REM paramater 3 is the nzb name
set name=%3
REM remove quotes from the name
set name=%name:"=%
REM replace _ with space
set newname=%name:_= %
REM rename the directory
rename "%root%\%dirname%" "%newname%"
I've not tested this, so forgive any errors!