coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:
Anyone have any pointers?
Could it essentially be going too fast and renaming some to "" which causes Windows to delete them? I figured an error would appear somewhere if it failed to rename something.opendir(DIR, $dir) || die "can't opendir $dir: $!"; my @files =grep { /\.jpg$/i || /\.gif/i || /\.png/i || /\.bmp/i || /\ +.jpeg/i} readdir(DIR); closedir DIR; foreach my $file (@files) { my $ext; $file =~ m/(.[^.]+)$/; $ext = $1; $cnt++; rename $file, "$cnt$ext" or die $!; print "$file is now known as $cnt$ext\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Renaming a group of files occassionally deletes some
by FunkyMonk (Bishop) on Jun 01, 2007 at 17:57 UTC | |
|
Re: Renaming a group of files occassionally deletes some
by blazar (Canon) on Jun 01, 2007 at 17:41 UTC | |
by coldfingertips (Pilgrim) on Jun 01, 2007 at 18:51 UTC | |
by Util (Priest) on Jun 01, 2007 at 21:05 UTC | |
|
Re: Renaming a group of files occassionally deletes some
by semio (Friar) on Jun 01, 2007 at 20:34 UTC |