Re: [PHP] Re: Copying Directory
Thanks, But I can try it ,cause I like PHP and I want to write a code tahat runs anyware. Actually, we use both *nix & windows. I will announce if I could madde it. Regards, Hiroshi 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
Re: [PHP] Re: Copying Directory
On Monday 08 April 2002 17:04, Hiroshi Ayukawa wrote: > Sorry, > It didn't work.Mine too. > ALL of the files inside the deeoer directory come to top of the > directory. > I'll go on trying . > Thanks. > > By the way , your script looks like Python script , dont'you? Probably the easiest way is to some system functions. If you're on some *nix system use cp, if on windows use xcopy. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Think sideways! -- Ed De Bono */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Copying Directory
Sorry, It didn't work.Mine too. ALL of the files inside the deeoer directory come to top of the directory. I'll go on trying . Thanks. By the way , your script looks like Python script , dont'you? Hiroshi AYukawa 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
[PHP] Re: Copying Directory
there was a typo...this one should work # # # boolean copy_dirs ( string src_dir, string target_dir ) # # # copy a directory with subdirectories to a target directory # # 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 ( !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
[PHP] Re: Copying Directory
# # # 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