MLUG: Re: [MLUG] Need Program, Mind Not Working
Re: [MLUG] Need Program, Mind Not Working
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
This should also work:
-----------------------------------------
split "/", $ARGV[0];
$_[$#_] =~ s/\ /\_/g;
$_[$#_] = lc($_[$#_]);
$new_name = join '/', @_;
print "mv \"$ARGV[0]\" \"$new_name\"\n" 
  unless ($new_name eq $ARGV[0]);
-----------------------------------------

since you said you wanted a record of what changed you
can do this first:
find -depth -exec perl change.pl {} \; > changed.txt

then call like:
find -depth -exec perl change.pl {} \; | sh



--- Stephen Montgomery-Smith 
> > Oops, last script was incorrect:
> > 
> 
> Wrong again:
> 
> #!/usr/bin/perl -w
> open F,"find -d . |";
> while (<F>) {
>   chomp;
>   if (/(.*)\/(.+)/) {
>     $dir=$1;
>     $file=lc($2);
>     $file=~s/\ /\_/g;
>     $dir=~s/\ /\\\ /g;
>     s/\ /\\\ /g;
>     system "mv $_  $dir/$file\n";
>   }
> }


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/