Page 1 of 1

Script for changing filetyp from .nfo to .whatever

Posted: April 18th, 2013, 4:22 pm
by Chillout
Heyho.

I need a Script for sabnzbd which changes the filetyp (only renames) from .nfo to .whatever, because i'm scraping all movie informations which will be saved in a .nfo-file.

All in all i'm not a coder, just a user and designer.

My first idea was something like this

Code: Select all

mv *.nfo old_filename.whatever
But as already said, i don't know how exactly :)

Would be great if someone just posts an simple script.

Cheers,
Chillout

Re: Script for changing filetyp from .nfo to .whatever

Posted: April 18th, 2013, 11:38 pm
by sander
How about:

Code: Select all

rename 's/\.nfo$/.whatever/' *

Works for me:


Code: Select all

sander@toverdoos:~/kul$ touch adfaadsf.nfo
sander@toverdoos:~/kul$ touch adfff.nfo
sander@toverdoos:~/kul$ touch djdjdj.nfo
sander@toverdoos:~/kul$ ll *nfo
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 adfaadsf.nfo
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 adfff.nfo
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 djdjdj.nfo
sander@toverdoos:~/kul$
sander@toverdoos:~/kul$ rename 's/\.nfo$/.whatever/' *
sander@toverdoos:~/kul$
sander@toverdoos:~/kul$ ll *whatever
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 adfaadsf.whatever
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 adfff.whatever
-rw-rw-r-- 1 sander sander 0 2013-04-19 06:36 djdjdj.whatever
sander@toverdoos:~/kul$
Assuming Linux / Unix / OSX