Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The output for the last print statemen gives me " is old and new is new" and says "Failed to rename". Thanks again...die("Cannot open /cdw/home_dir/s006258/MarketingDB/.") unless(opendir(DIR, "/cdw/home_dir/s006258/MarketingDB/")); #Print to new file die("Cannot open Log file to read from.") unless(open(FILES, ">List_of_files_changed.txt")); print "Reading from file\n"; #reading from file for my $file (readdir(DIR)) { if($file =~ /^append/) { print "$file\n"; $old=$_; s/^append/aPPend/; die "$_ already exists" if (-e $_); print "$old is old and $_ is new\n"; rename($old, $_) or die "Failed to rename\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: trying to rename files
by ikegami (Patriarch) on Jun 09, 2006 at 20:25 UTC | |
by Anonymous Monk on Jun 09, 2006 at 20:29 UTC | |
|
Re: trying to rename files
by philcrow (Priest) on Jun 09, 2006 at 20:40 UTC | |
by Anonymous Monk on Jun 09, 2006 at 21:15 UTC | |
|
Re: trying to rename files
by gellyfish (Monsignor) on Jun 09, 2006 at 20:39 UTC | |
|
Re: trying to rename files
by bigmacbear (Monk) on Jun 09, 2006 at 20:45 UTC |