Re: file renamer (i'm a newbie)

2006-03-30 Thread Jasper
On 3/30/06, Philippe 'BooK' Bruhat <[EMAIL PROTECTED]> wrote: > By the way, golfers, do we have a name for the secret circumfix > @{[]} operator? A derefarrance? (deref-array-nce) ? > Even the most powerful being is at the mercy of the weakest. > (Moral from

Re: file renamer (i'm a newbie)

2006-03-30 Thread Philippe 'BooK' Bruhat
Le samedi 25 mars 2006 à 00:07, Eric Waguespack écrivait: > You are really helpful... thanks for all the info. > > here is my latest code... now l'll take a few minutes to digest your > suggestions. > ># fix odd extensions >$new =~ s/\.mpeg$/\.mpg/; >$new =~ s/\.ram$/\.rm/; >$new

Re: file renamer (i'm a newbie)

2006-03-25 Thread Eric Waguespack
that is pretty cool... I'll have to remember it. On 3/25/06, Andrew Savige <[EMAIL PROTECTED]> wrote: > --- Eric Waguespack wrote: > > ok... > > > > #!/usr/bin/perl -nl > > $o=$_;y/ /_/;-e||print("renaming $o ===> $_")&&rename$o,$_ > > > > > > ok so you are looping around <> and adding newlines...

Re: file renamer (i'm a newbie)

2006-03-24 Thread Andrew Savige
--- Eric Waguespack wrote: > 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. > >

Re: file renamer (i'm a newbie)

2006-03-24 Thread Eric Waguespack
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.

Re: file renamer (i'm a newbie)

2006-03-24 Thread Eric Waguespack
You are really helpful... thanks for all the info. here is my latest code... now l'll take a few minutes to digest your suggestions. #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find; finddepth(\&fixnames, "."); sub fixnames { # do not rename dotfiles return if /^\

Re: file renamer (i'm a newbie)

2006-03-24 Thread Andrew Savige
--- Eric Waguespack wrote: > I was asking how to shorten it up to a one-liner using various perl > idioms... OK, I was just trying to protect you from the madness that is Perl golf. ;-) If you don't believe me, you can read about some of the history of Perl golf here: http://www.perlmonks.org/?n

Re: file renamer (i'm a newbie)

2006-03-24 Thread Andrew Savige
--- Eric Waguespack wrote: > Currently the file below renames files by changing spaces to underscores. > usage: > find | ./file_name_fixer.pl > > how could it be shortened up? > > I would eventually like to modify it so that it will will modify names > so that they only contain 'a-z0-9._' For so

file renamer (i'm a newbie)

2006-03-24 Thread Eric Waguespack
Currently the file below renames files by changing spaces to underscores. usage: find | ./file_name_fixer.pl how could it be shortened up? I would eventually like to modify it so that it will will modify names so that they only contain 'a-z0-9._' thanks. #!/usr/bin/perl while (<>) { chomp;