On Wed, 2007-05-16 at 11:17 -0600, Paul Seamons wrote:
> > I, for one, would be grateful if your would post your perl snippet with
> > newlines and formatting.
> 
> perl -e '
>     use File::Find;            # load the library
>     find(sub{
>         return if ! -d;        # must be a directory
>         return if ! /^(.{5})_/ # match 5 chars and then _
>         rename ($_, $1)
>             || warn "Err: $_ => $1: $!";
>     }, ".");                   # look in "." for files
> ' 
> 
> perl -e '
>    opendir $dh, ".";           # open directory inode as a handle
>    for (readdir $dh) {         # iterate on files in $dh
>         next if ! -d;          # must be a directory
>         next if ! /^(.{5})_/;  # match 5 chars and then _
>         rename($_, $1)
>             || warn "Err: $_ => $1: $!"
>    }
> ' 

Awesome.  Thanks.



/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to