Why does Perl's File::Copy appear to silently fail?
copy, perl, windows-server-2008
Solution
From the documentation:
RETURN
All functions return 1 on success, 0 on failure. $! will be set if an error was encountered.
The example fails silently because nothing is checking what $! is on failure. Try this:
move($from, $to) || die "Failed to move files: $!";
Problem
I have a Perl script that works on Windows XP. It uses File::Copy's `move` function to move a directory tree to another place on the same drive. The script fails (silently) on Windows 2008. Nothing moved, nothing deleted. I am using ActiveState Perl 5.10.0 Build 1005 and the File::Copy that comes with it. Anyone know of issues with ActiveState Perl on Windows 2008 that might cause this? Example script: ``` use File::Copy; print "Move AAA to ZZZ\n"; move("AAA", "ZZZ"); print "Done.\n"; ```