Functions that simulate Xcopy /*************************************
* System name: function to simulate xcopy
* Program function: Simulate the function of Xcopy
* Development Date: 2003/03/14
*************************************/
?>
Copy a direction ' s all files to another direction
function XCopy ($source, $destination, $child) {
Usage:
XCopy ("Feiy", "Feiy2", 1): Copy files under Feiy to Feiy2, including subdirectories
XCopy ("Feiy", "Feiy2", 0): Copy files under Feiy to Feiy2, excluding subdirectories
Parameter description:
$source: Source directory Name
$destination: Destination directory Name
$child: When copying, is not a contained subdirectory
if (!is_dir ($source)) {
Echo ("Error:the $source is not a direction!");
return 0;
}
if (!is_dir ($destination)) {
mkdir ($destination, 0777);
}
$handle =dir ($source);
while ($entry = $handle->read ()) {
if ($entry! = ".") && ($entry! = "...")) {
if (Is_dir ($source. " /". $entry)) {
if ($child)
XCopy ($source. " /". $entry, $destination." /". $entry, $child);
}
else{
Copy ($source. " /". $entry, $destination." /". $entry);
}
}
}
return 1;
}
?>
http://www.bkjia.com/PHPjc/314374.html www.bkjia.com true http://www.bkjia.com/PHPjc/314374.html techarticle a function that simulates xcopy? PHP/************************************* * System name: Simulate xcopy Function * Program function: function of simulating xcopy * development Date: 2003/03/14 ****** ******...