Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple file copy not working..

Status
Not open for further replies.

jorkus

Technical User
May 21, 2003
2
NO
I have the folowing lines as a part of a perl script, but the filecopy does not work... works fine when the command is performed i "dos" Tips anyone?


$cpfileto = "d:\\ftp\\images\\bilder\\image.jpg";
$cpfilefrom = "d:\\ftp\\images\\Cap_2665.JPG";
'copy $cpfilefrom $cpfileto';
LogMsg("copy /y $cpfilefrom $cpfileto");
sub LogMsg
{
my ($msg) = (@_);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
printf("%02d/%02d/%02d %02d:%02d:%02d $msg\n", $year + 1900, $mon + 1, $mday, $hour, $min, $sec);
}
 
They look like apostrophes around the copy command, not back-quotes. Personally I would use the system() function for clarity, but back-quotes should also do the trick.

Annihilannic.
 
Use the File::Copy module

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Thanks! I think I need glasses, back quote did the trick!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top