1

I need help or answer is it possible to copy directory with all content. I have two web sites on same server. And i need to copy:

source: home/public/first/images

destination: home/public/second/images

and if is possible to do that i need to setup crone job for auto sync that two directories every 5 minutes for example. I was try this screenshot code Sorry for bad English i hope you understand my problem

Dejan
  • 11
  • 2
  • What's wrong with your previous try? – fusion3k Feb 02 '16 at 01:34
  • I goth this msg but actualy nothing hapents Copy Paste completed! – Dejan Feb 02 '16 at 01:39
  • this is code i use $source = '/path/to/source/'; $destination = 'path/to/destination/'; $sourceFiles = glob($source . '*'); foreach($sourceFiles as $file) { $baseFile = basename($file); if (file_exists($destination . $baseFile)) { $originalHash = md5_file($file); $destinationHash = md5_file($destination . $baseFile); if ($originalHash === $destinationHash) { continue; } } copy($file, $destination . $baseFile); } echo "

    Copy Paste completed!

    "; //output when done
    – Dejan Feb 02 '16 at 01:42
  • 1
    what message? [Here](http://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php) there's another example. Read careful. **Please put your code in the original answer (edit-it), not in the comments** – fusion3k Feb 02 '16 at 01:45

0 Answers0