How to cut and paste the folder? What is the code in php?

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 "\"?

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!

Member Avatar

diafol

Code at the link no good?

You can use FTP to move folders.

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

Member Avatar

diafol

You can use ftp functions within php.

which function and how to use it, any example?

Member Avatar

diafol

How about you look at the php manual > FTP functions.

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

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;
}


?>