CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
trouble copying a file?!



Jan 16, 2001, 9:44 AM

Post #1 of 1 (521 views)
trouble copying a file?! Can't Post

can anybody suggest a better way to do this:

sub create_index { 
# if ($verbose_mode) {my $message = "updating master index in $current_dir\n"; write_log($message)}
my @copy_this = ("cp", "$masterindex_file", "$current_dir");
system(@copy_this) == 0 or die "system @copy_this fails again $?\n";


For whatever reason my script complains that the copy failed because the target directory
doesn't exist. The target directory is definitely there.

I've tried 'sleeping' the script to give the target directory time to be built, but this doesn't help at all.

I've also tried creating the directory BEFORE running the script.

If I rerun the script everything is OK! the file get's copied to the target as expected.

also if you can explain what's broken ....

This really has me baffled !


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives