#########################################################
#
# boolean copy_dirs ( string src_dir, string target_dir )
#
#########################################################
# copy shopdirectories into a new shop
#########################################################
# Function Parameters:
# string src_dir: source directory
# string target_dir: target directory
#########################################################
# Return Values:
# 0 - error while copying
# 1 - files copied successfully
#########################################################
function copy_dirs ( $src_dir, $target_dir ) {
$src_dir = ereg_replace ( "/$", "", $src_dir );
$target_dir = ereg_replace ( "/$", "", $target_dir );
if ( filetype ( $src_dir ) != "dir" ):
return (0);
endif;
if ( !file_exists ( $target_dir ) ):
mkdir ( $target_dir, 0777 );
endif;
$hdl = opendir ( $src_dir );
while ( ( $file = readdir ( $hdl ) ) !== false ):
if ( $file != "." && $file != ".." && $file != "" ):
if ( filetype ( $src_dir."/".$file) == "dir" ):
if ( filetype ( $src_dir."/".$file) == "dir" ):
if ( !copy_dirs ( $src_dir."/".$file,
$target_dir."/".$file ) ):
return (0);
endif;
else:
if ( !copy ( $src_dir."/".$file, $target_dir."/".$file ) ):
return (0);
endif;
endif;
endwhile;
return (1);
}
"Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I guess anyone have made the function to coppy directories, not files.
> I'd like to copy directory including sub directories to other place.
> Doesn't anyone has mades that kind of function?And please telll me.
>
> Thamks in advance.
> HiroshiAyukawa
> http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php