copy folder from source directory to destination directioy

by kalai 2010-03-02 20:29:36


function copy_directory( $source, $destination ) {
if ( is_dir( $source ) ) {
@mkdir( $destination );
$directory = dir( $source );
while ( FALSE !== ( $readdirectory = $directory->read() ) ) {
if ( $readdirectory == '.' || $readdirectory == '..' ) {
continue;
}
$PathDir = $source . '/' . $readdirectory;
if ( is_dir( $PathDir ) ) {
copy_directory( $PathDir, $destination . '/' . $readdirectory );
continue;
}
copy( $PathDir, $destination . '/' . $readdirectory );
}

$directory->close();
}else {
copy( $source, $destination );
}
}
copy_directory ("upload/".$file1, "uploaded/".$file1);


After execution this function folder from upload directory is copied to uploaded directory

Tagged in:

900
like
0
dislike
0
mail
flag

You must LOGIN to add comments