@@ 225-233 (lines=9) @@ | ||
222 | ||
223 | // Open the source directory to read in files |
|
224 | $iterator = new DirectoryIterator($src); |
|
225 | foreach ($iterator as $fObj) { |
|
226 | if ($fObj->isFile()) { |
|
227 | rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
228 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
229 | // Try recursively on directory |
|
230 | self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
231 | // rmdir($fObj->getPath()); // now delete the directory |
|
232 | } |
|
233 | } |
|
234 | $iterator = null; // clear iterator Obj to close file/directory |
|
235 | return rmdir($src); // remove the directory & return results |
|
236 | } |
|
@@ 268-274 (lines=7) @@ | ||
265 | ||
266 | // Open the source directory to read in files |
|
267 | $iterator = new DirectoryIterator($src); |
|
268 | foreach($iterator as $fObj) { |
|
269 | if($fObj->isFile()) { |
|
270 | copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
271 | } else if(!$fObj->isDot() && $fObj->isDir()) { |
|
272 | self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj-getFilename()); |
|
273 | } |
|
274 | } |
|
275 | return true; |
|
276 | } |
|
277 | } |