private static function rmove($src, $dest){
    // If source is not a directory stop processing
    if(!is_dir($src)) {
      echo "Source is not a directory";
      return false;
    }

    // If the destination directory does not exist create it
    if(!is_dir($dest)) {
        if(!mkdir($dest,0777,true)) {
            // If the destination directory could not be created stop processing
            echo "Can't create destination path: {$dest}\n";
            return false;
        }
    }

    // Open the source directory to read in files
    $i = new \DirectoryIterator($src);
    foreach($i as $f) {
      #Skip useless files&folders
      if (self::isFileIgnored($f->getFilename())) continue;

      if($f->isFile()) {
        rename($f->getRealPath(), "$dest/" . $f->getFilename());
      } else if(!$f->isDot() && $f->isDir()) {
        self::rmove($f->getRealPath(), "$dest/$f");
        #unlink($f->getRealPath());
      }
    }
    #We could Remove original directories but don't do it
    #unlink($src);
  }
private static function rmove($src, $dest){
    // If source is not a directory stop processing
    if(!is_dir($src)) {
      echo "Source is not a directory";
      return false;
    }

    // If the destination directory does not exist create it
    if(!is_dir($dest)) {
        if(!mkdir($dest,0777,true)) {
            // If the destination directory could not be created stop processing
            echo "Can't create destination path: {$dest}\n";
            return false;
        }
    }

    // Open the source directory to read in files
    $i = new \DirectoryIterator($src);
    foreach($i as $f) {
      #Skip useless files&folders
      if (self::isFileIgnored($f->getFilename())) continue;

      if($f->isFile()) {
        rename($f->getRealPath(), "$dest/" . $f->getFilename());
      } else if(!$f->isDot() && $f->isDir()) {
        self::rmove($f->getRealPath(), "$dest/$f");
        #unlink($f->getRealPath());
      }
    }
    #We could Remove original directories but don't do it
    #unlink($src);
  }
private static function rmove ( $ src , $ dest ) { // If source is not a directory stop processing if ( ! is_dir ( $ src ) ) { echo "Source is not a directory" ; return false ; } // If the destination directory does not exist create it if ( ! is_dir ( $ dest ) ) { if ( ! mkdir ( $ dest , 0777 , true ) ) { // If the destination directory could not be created stop processing echo "Can't create destination path: {$dest}\n" ; return false ; } } // Open the source directory to read in files $ i = new \ DirectoryIterator ( $ src ) ; foreach ( $ i as $ f ) { #Skip useless files&folders if ( self :: isFileIgnored ( $ f -> getFilename ( ) ) ) continue ; if ( $ f -> isFile ( ) ) { rename ( $ f -> getRealPath ( ) , "$dest/" . $ f -> getFilename ( ) ) ; } else if ( ! $ f -> isDot ( ) && $ f -> isDir ( ) ) { self :: rmove ( $ f -> getRealPath ( ) , "$dest/$f" ) ; #unlink($f->getRealPath()); } } #We could Remove original directories but don't do it #unlink($src); }
Recursively move files from one directory to another

@param String $src - Source of files being moved
@param String $dest - Destination of files being moved
Recursively move files from one directory to another