PHP is often used in the development of files, folders and files copy, copy and so on.
/** * Folder File copy * * @param string $src source folder * @param string $dst destination folder * @return bool*/functionDir_copy ($src= ",$DST= ' '){ if(Empty($src) ||Empty($DST)) { return false; } $dir=Opendir($src); Dir_mkdir ($DST); while(false!== ($file=Readdir($dir))) { if(($file! = '. ') && ($file! = ' ... ')) { if(Is_dir($src. ‘/‘ .$file) {dir_copy ($src. ‘/‘ .$file,$DST. ‘/‘ .$file); } Else { Copy($src. ‘/‘ .$file,$DST. ‘/‘ .$file); } } } Closedir($dir); return true;} /** * Create Folder * * @param string $path folder path * @param int $mode access rights * @param bool $recursive Whether to create recursively * @return BOOL*/functionDir_mkdir ($path= ",$mode= 0777,$recursive=true){ Clearstatcache(); if(!Is_dir($path)) { mkdir($path,$mode,$recursive); return chmod($path,$mode); } return true;}
PHP--------folder file copy and copy