Задача - периодическая репликация папок, т.е. копирование только измененного или нового содержимого. Есть рабочий php скрипт:
CODE (htmlphp):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?php
- function dircpy($source, $dest, $overwrite = false){
- if(!is_dir($dest))
- mkdir($dest);
- if($handle = opendir($source)){
- while(false !== ($file = readdir($handle))){
- if($file != '.' && $file != '..'){
- $path = $source . '/' . $file;
- if(is_file($path)){
- if(!is_file($dest . '/' . $file) || $overwrite)
- if(!@copy($path, $dest . '/' . $file)){
- echo '<font color="red">File ('.$path.') could not be copied, likely a permissions
- problem.</font>';
- }
- } elseif(is_dir($path)){
- if(!is_dir($dest . '/' . $file))
- mkdir($dest . '/' . $file); // make subdirectory before subdirectory is copied
- dircpy($path, $dest . '/' . $file, $overwrite); //recurse!
- }
- }
- }
- closedir($handle);
- }
- }
- $zz="D:\JAVA\-from" ;
- $zx="L:\-to" ;
- dircpy($zz, $zx, $overwrite = false);
- ?>