

Adventures in Shell Scripting - billswift
http://www.goodbyemicrosoft.net/news.php?extend.488

======
RiderOfGiraffes
Of course, for the given question you can simply do:

    
    
        rename oldname newname *
    

or, for other unix-like systems/flavors

    
    
        rename "s/oldname/newname/" oldname.*

~~~
billswift
Thanks, I've been using Linux for 13 years now and didn't even know the rename
command existed; I was taught to use mv to rename files.

~~~
RiderOfGiraffes
I've been using Unix/Linux for nearly 20 years, and I stumbled across the
"rename" command about 5 years ago when I was regularly using 5 different
operating systems. I typed "rename" and wondered why it didn't do what I
expected. I had intended "mv".

Don't confuse them. I used the difference to learn more precisely what happens
in a filing system when you do a "mv" as compared with a "rename". It was
interesting.

I've since forgotten most of the details, but it occasionally proves useful.

------
billswift
This is a minor script, even I was doing this sort of stuff ten years ago, but
this is the sort of stuff I would like to see more of. So my question, and
primary reason for posting this, is: what web sites and aggregators do you
know where this kind of stuff, interesting scripts and even functions, is
posted? Most of the more formal sites like CPAN for perl are a pain for just
browsing to learn new tricks and ideas.

~~~
akirk
Check out <http://www.commandlinefu.com/>

~~~
billswift
Thanks, I had actually seen this site before, but it was one of the many I
lost track of when my hard-disk controller died a couple years ago. It went
goofy before it died and scrambled a lot of stuff on my hard drive so I
couldn't recover it when I got a new computer.

EDIT: I'm not a total idiot, I was backing up most of my files, but I often
forgot to back up my favorites list.

------
sjs

        autoload zmv
        zmv 'oldname.*' 'newname.$1'

------
erlanger
If this is an adventure, driving to McDonalds is an epic journey.

