Copy files from one folder to another using php
Posted by navaneeth on Jun 28, 2014 in General, Php | No comments yet

Inorder to copy files from one folder to another using php we can use the php’s inbuilt function called copy .Now we are creating an function in which we need only to specify the source directory and the destination directory
function copy_files($source,$destination) { $dir = opendir($src); @mkdir($dst); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { if ( is_dir($source. '/' . $file) ) { recurse_copy($source. '/' . $file,$destination. '/' . $file); } else { copy($source. '/' . $file,$destination. '/' . $file); } } } }
Hope this code snippet helps somebody to copy files from one folder to another using php
Leave a Reply