Smaug has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use File::Copy; my $PPath=($ENV{Project}); my $LogPath=("$PPath/midnight_reset/log"); my $CPath=($ENV{CONFIG_DIR}); $CPath=~s/\\/\//g; my $file; my $logpath=("$CPath/Agents/log"); opendir (DIR, $logpath) || die "Cannot open dir $logpath: $!"; my @files=grep(/\.log$/i, readdir (DIR)); foreach $file (@files) { unless (copy ("$logpath/$file", "$logpath/$file.old")) { print "Fail to rename $file\n"; } } closedir (DIR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: rename and move fail?
by tachyon (Chancellor) on Oct 01, 2003 at 07:13 UTC | |
by Smaug (Pilgrim) on Oct 01, 2003 at 08:44 UTC |