xcopy gives invalid drive specification
Posted on 2007-03-22
I am still kinda of new to PERL programming, and need some help with system commands, pipes, and network shares / drives on Windows. I am trying to XCOPY a file to a network drive or share, but I am getting "Invalid Drive Specification" when I run the script from CGI. If I drop down to command line, and simply DOS XCOPY the files, it works fine.
What do I need to specify for PERL so that it KNOWS about my network drives and shares? Why is it that when I try it from DOS it works fine, but when I run it from my script it fails with "Invalid Drive Specification"?
my $cmd = 'xcopy '.$datafile.' '.$mailpickup.'';
local *ALERTOUT = IO::File->new_tmpfile;
local *ALERTERR = IO::File->new_tmpfile;
local *ALERTIN = IO::File->new_tmpfile;
my $pid = open3(">&ALERTIN", \*ALERTOUT, ">&ALERTERR", $cmd);
I am using IPC::Open3 to make the system calls and read the STDOUT & STDERR into arrays for parsing so I can check the results of the operation. I can post the rest of code if needed, but I've tried replacing the $CMD arguments with something simple like "dir" and it works fine, no errors. So I think it's got something to do with the network aware drives and shares available to PERL, please help...
Thanks in advance,