Problem with XCopy

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
winsonlee
Forum Commoner
Posts: 76
Joined: Thu Dec 11, 2003 8:49 pm

Problem with XCopy

Post by winsonlee »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I try to copy all the files that i manage to find in to the temp directory but somehow it doesnt seems to be working.
Anyone here knows why ??

Code: Select all

<?php
// include class

include("Find.php");

// initialize finder
$finder = new File_Find();

// search for matching files 
// in named directory and subdirectories
$results = $finder->search("/pdf/i", "C:/Program Files/", "perl");




for ($i=0; $i<sizeof($results);$i++){
  echo $results[$i]."<BR>";

exec('xcopy '.$results[$i].' C:\\TEMP', $a, $a1);
  
}



?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

What errors are you getting?

Code: Select all

ini_set('display_errors','On');
error_reporting(E_ALL);
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
winsonlee
Forum Commoner
Posts: 76
Joined: Thu Dec 11, 2003 8:49 pm

Post by winsonlee »

There is no error in it.
Just that files is not copied to the new directory only
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why on Earth are you trying to use xcopy when there's copy()?
deiremus
Forum Newbie
Posts: 5
Joined: Sat Dec 12, 2009 4:46 am

Re: Problem with XCopy

Post by deiremus »

try using s switch on your shell command

exec('xcopy '.$results[$i].' C:\\TEMP /E', $a, $a1);

the switch will copy all the folders (even if its empty) and files and folders in it
Post Reply