Page 1 of 1

Auto Rename, Name expand

Posted: December 8th, 2011, 10:39 am
by D3ltoroxp
Hello Community,

i need your help. I will make me a script that makes the following...

For example. SabNZB rename the file to this Lost-S02E05.avi

Now i will that SabNZB write this "SDTV" in the Filename like this :: Lost-S02E05.SDTV.avi

But only for the Series Lost.
For another Serie for example HDTV, SDRIP and so on.

Is this feasible with such a script ?
I imagine it like this.

I make a categorie with Series SDTV and there is tha script that add SDTV to the filename and so on for the other things...

Greet's D3

Re: Auto Rename, Name expand

Posted: December 8th, 2011, 12:59 pm
by sander
Yes, that's possible.

With the info from http://wiki.sabnzbd.org/user-scripts , it could be something like this pseudo-code:

for all files in $1 and its subdirectories:
if file = *.avi:
extension = extension(file)
basename = basename(file)
newname = basename + SDTV + extention
rename file to newname


It depends on the operating system you use (Linux, Mac, or Windows) what the script looks like exactly. See http://forums.sabnzbd.org/viewtopic.php?f=9&t=9556 for an example of a Linux script.
I found some nice bash script on http://liquidat.wordpress.com/2007/09/2 ... ll-script/

for file in *.$1; do
mv $file `basename $file $1`.$2
done

You could call the above script with '<script> avi SDTV.avi'. Just one script for all renaming ... beautiful! Note: the aboven $1 and $2 are other parameters than the $1 etc from SABnzbd.

I have no Windows, so I can't help you there. Oh, wait: looks easy: http://www.addictivetips.com/windows-ti ... n-windows/ So "ren *.jpg *.jpg" would be "ren *.avi *.SDTV.avi" in your case. So, complete script:

cd $1
ren *.avi *.SDTV.avi

Re: Auto Rename, Name expand

Posted: December 14th, 2011, 4:12 pm
by D3ltoroxp
Many thanks to you. But I can therefore create a script ? I have no plan ? Is that all what my script needed ? What kind of file extension is needed ?