I would suggest stepping through the program with a debugger or adding a print join " ", @files; print "\n"; at the end of your loop to find if your @files array is getting munged somehow. That is where my first guess at the problem would be.
My second guess would involve permission issues and or failure of the move as suggested by others.
And my final guess would involve issues with your installation of perl under windows...
My working test code
#!/usr/bin/perl use File::Copy; @files = ("ATMCAF00", "ATMCAF01", "ATMCAF12", "ATMCMF01", "ATMCMF12"); $old = "."; $new = "/ATM/"; print "Enter the month and day (ex:0605)\n"; $date = <stdin>; chomp($date); foreach my $file (@files) { print "Moving $old$file to $new$file$date \n"; if(move("$old$file","$new$file$date")) { print "$file has been moved\n"; } else { print "Error moving $old$file <$!>\n"; } print "---------------------------------------------\n"; } print "All the ATM files have been renamed and move to the ATM folder\ +n"; $wait = <stdin>;
In reply to Re^4: Moving files
by 5mi11er
in thread Moving files
by SteveS832001
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |