in reply to Perl - Copy files to a newly created folder

There are two possibilities: 1) It's unable to copy some of the files because of a permissions issue or some other filesystem restriction (but this should produce errors), or 2) it's not always doing what you think it's doing.

To investigate the second possibility, add some print statements to your code that show what it's doing, like this:

print "Copying '$source' to '$destination'\n"; copy($source,$destination) or die $!;

I put single quotes around the filenames so any whitespace in the names will be apparent. Make sure you print the same arguments that you're passing to the copy() routine, and then you'll be able to see if they are what you expect them to be. This is a very simple debugging method: when your program isn't doing what you expect, check the values of the variables that control its behavior.

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.