exec a copy command over network

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dubbelpunt
Forum Newbie
Posts: 3
Joined: Thu Mar 09, 2006 8:01 am

exec a copy command over network

Post by dubbelpunt »

I have a file on my local C:\-drive. I would like to copy this file to another drive on the network. This drive is situated in a Unix-system. In my windows-system the drive is named as I:\.

I've tried the following exec-commando's, but none of them work.

Code: Select all

exec('copy C:\Inetpub\wwwroot\tbs\orders\sxw\eentest.sxw I:\spooloo\eentest.sxw');
and

Code: Select all

exec('copy C:\Inetpub\wwwroot\tbs\orders\sxw\eentest.sxw \\192.1.6.226\info\spooloo\eentest.sxw');
The directory spooloo has writable access on both the linux and windows system.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try

Code: Select all

$result = system('copy C:\\Inetpub\\wwwroot\\tbs\\orders\\sxw\\eentest.sxw \\\\192.1.6.226\\info\\spooloo\\eentest.sxw', $return);
if($result === false)
{
  echo 'copy call failed: ' . $return;
}
else
{
  echo 'copy returned: ' . $result;
}
Although php has a copy function. Have you tried it? copy()
dubbelpunt
Forum Newbie
Posts: 3
Joined: Thu Mar 09, 2006 8:01 am

Post by dubbelpunt »

this doesn't work either.

Copying in general is not the problem. I've copied several times from one directory to another on my local drive. He just won't copy on my networkdrive (this drive is on the server).

I want to know how I call a network drive in the exec() command.
gunhippy
Forum Newbie
Posts: 3
Joined: Tue Mar 28, 2006 5:56 am

Post by gunhippy »

Have you thought about mapping the network drive to a drive letter / mont before running the command so essentially php will think it's copying from drive to drive as opposed to from drive to UNC??
Post Reply