develooper Front page | perl.golf | Postings from March 2006

Re: file renamer (i'm a newbie)

Thread Previous | Thread Next
From:
Eric Waguespack
Date:
March 24, 2006 22:56
Subject:
Re: file renamer (i'm a newbie)
Message ID:
1c246150603242256l5e6838a3p2eb399562f38e2a4@mail.gmail.com
ok...

#!/usr/bin/perl -nl
$o=$_;y/ /_/;-e||print("renaming $o ===> $_")&&rename$o,$_


ok so you are looping around <> and adding newlines...
saving the name as $o
y is an alias for tr
checking if the file exists with -e
|| print msg && rename.

very nice, thanks a lot.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About