On Wed, 3 Sep 2003, Josenildo Marques wrote:
> 
> I tried the rename script, but I can't get the date to appear, even using the
> -d switch...
> 
> TIA
> 
> --
> cyb
> 

Cyb,

I'm assuming you're working with a bash script and I've used bash for 
this, but I've found perl to be easier to work with. I've got a script 
already written that does something similar to what you're needing. It 
would take only a wee bit of modification to change it to do specifically 
what you want. I've attached it. Please feel free to modify it any way you 
wish. if you have any questions just holler. 

-- 
Mark

"If necessity is the mother of invention, then who's the father?"
-----------------------------------------------------------
Paid for by Penguins against modern appliances(R)
Linux User Since 1996
Powered by Mandrake Linux 8.2 & 9.1
ICQ# 27816299
#!/usr/bin/perl

# Read in the data from the form

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@appdata = split(/&/, $buffer);

# Do a little quick decoding of all the form data so we can use it

foreach $appdata (@appdata) {
        ($name, $value) = split(/=/, $appdata);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $FORM{$name} = $value;
}

#print "Including the trailing \('/') slash \n";
#print "place the directory path here: ";
$path = "/home/mdw1982/mas_bookpics/";

exec(`ls --width=1 $path > dir.txt`);
open(FILE,"<dir.txt");
@a = <FILE>;
close(FILE);

foreach $item(@a){
        chomp($item);
        if($item =~ /^0/ && $item != /([A-Za-z])/){
        print "\n";
        #print "$item\n";
        $var = $item;
                                                  #$I = $item;
        @I = split(/-+/,$item);
        $result = join("", " ", @I);
        print "$result\n";                        #$I =~ s/([A-Z])/lc($1)/eog;
        $arg1 = "$path$var";
        $arg2 = "$path$result";
        exec(`mv -f "$arg1" "$arg2"`);
        }
      }

print "everything has been read and reported\n\n";

        
        
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to