Conditions | 8 |
Paths | 10 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | function rcopy($src, $dest) |
||
42 | { |
||
43 | |||
44 | // If source is not a directory stop processing |
||
45 | if (!is_dir($src)) return false; |
||
46 | |||
47 | // If the destination directory does not exist create it |
||
48 | if (!is_dir($dest)) { |
||
49 | if (!mkdir($dest)) { |
||
50 | // If the destination directory could not be created stop processing |
||
51 | return false; |
||
52 | } |
||
53 | } |
||
54 | |||
55 | // Open the source directory to read in files |
||
56 | $i = new DirectoryIterator($src); |
||
57 | foreach ($i as $f) { |
||
58 | if ($f->isFile()) { |
||
59 | copy($f->getRealPath(), "$dest/" . $f->getFilename()); |
||
60 | } else if (!$f->isDot() && $f->isDir()) { |
||
61 | rcopy($f->getRealPath(), "$dest/$f"); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 | } |