2
Contributors
11
Replies
13
Views
6 Years
Discussion Span
Last Post by cliffcc
0

Can i creete the txt file and save as bat file? Then using the exec function?

The path is below:
$stringData1 = "move C:\xampp\htdocs\store\$abc\*.* C:\xampp\htdocs\store";
(How to handle "\"?

0

There are many files in one folder, i want to move it at once? Can you give me some example? I don't know this function! Thanks!

Edited by cliffcc: n/a

0

But i want to use php to trigger the cut and paste of the whole folder! Anyone can help!

0

I have look at the php manual ,I still have no ideas, can you help me?

0

Thanks!

<?php 





recurse_copy("C:/xampp/htdocs/.........","C:/xampp/htdocs/.........");

function recurse_copy($src,$dst) { 
    $dir = opendir($src); 
    @mkdir($dst); 
    while(false !== ( $file = readdir($dir)) ) { 
        if (( $file != '.' ) && ( $file != '..' )) { 
            if ( is_dir($src . '/' . $file) ) { 
                recurse_copy($src . '/' . $file,$dst . '/' . $file); 
            } 
            else { 
                copy($src . '/' . $file,$dst . '/' . $file); 
            } 
        } 
    } 
    closedir($dir); 
} 






delete_directory("C:/xampp/htdocs/........");


function delete_directory($dirname) {
	if (is_dir($dirname))
		$dir_handle = opendir($dirname);
	if (!$dir_handle)
		return false;
	while($file = readdir($dir_handle)) {
		if ($file != "." && $file != "..") {
			if (!is_dir($dirname."/".$file))
				unlink($dirname."/".$file);
			else
				delete_directory($dirname.'/'.$file); 		
		}
	}
	closedir($dir_handle);
	rmdir($dirname);
	return true;
}


?>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.