move the file or dir.
@param $source
@param $des
@return bool
344073
public static function move($source, $des)
    {
        if (!is_file($source)) {
            return false;
        }
        try {
            @rename($source, $des);
            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
994711
protected function copy($source, $dest)
    {
        // Check for symlinks
        if ( is_link($source) ) {
            return symlink(readlink($source), $dest);
        }

        // Simple copy for a file
        if ( is_file($source) ) {

            if (!file_exists($dest)) {
                copy(
                    $source,
                    $dest
                );
                return;
            }

            copy($source, str_replace('.php', '.php.dist', $dest));
            return;
        }

        // Make destination directory
        if ( !is_dir($dest) ) {
            mkdir($dest);
        }

        // Loop through the folder
        $dir = dir($source);
        while (FALSE !== $entry = $dir->read()) {
            // Skip pointers
            if ( $entry == '.' || $entry == '..' ) {
                continue;
            }

            // Deep copy directories
            $this->copy("$source/$entry", "$dest/$entry");
        }

        // Clean up
        $dir->close();

        return TRUE;
    }
992026
public function move($from, $to)
    {
        return $this->filesystem->move(
            $this->path($from),
            $this->path($to)
        );
    }
1249288
private function ensuredCopyDir($source, $destination)
    {
        try
        {
            $filesList = $this->getContents($source);

            foreach ($filesList as $file)
            {
                $path = $file['path'];
                $dest = explode(DIRECTORY_SEPARATOR, $path, 2);
                $dest = $destination . DIRECTORY_SEPARATOR . $dest[1];

                if ($file['type'] === Filesystem::TYPE_DIRECTORY)
                {
                    $this->copyDir($path, $dest);
                }
                else if ($file['type'] === Filesystem::TYPE_FILE)
                {
                    $this->copyFile($path, $dest);
                }
            }

            return;
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        throw new WriteException("Directory $source could not be copied to $destination.");
    }
1367434
public function moveFiles($source, $target, $files)
    {
        foreach ($files as $file) {
            $this->moveFile($source, $target, $files);
        }
    }
680197
public function moveDataFile($from, $to)
    {
        if (str_contains($from, '*.')) {
            $this->moveFilesWildcard($from, $to);

            return;
        }

        if (file_exists($from = $this->dataDir($from))) {
            $this->mkDir(dirname($to = $this->dataDir($to)));

            rename($from, $to);
        }
    }
563077
public static function copy_overwrite_files( $source, $dest ) {
		$iterator = new RecursiveIteratorIterator(
			new RecursiveDirectoryIterator( $source, RecursiveDirectoryIterator::SKIP_DOTS ),
			RecursiveIteratorIterator::SELF_FIRST
		);

		$error = 0;

		if ( ! is_dir( $dest ) ) {
			mkdir( $dest, 0777, true );
		}

		foreach ( $iterator as $item ) {

			$dest_path = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName();

			if ( $item->isDir() ) {
				if ( ! is_dir( $dest_path ) ) {
					mkdir( $dest_path );
				}
			} else {
				if ( file_exists( $dest_path ) && is_writable( $dest_path ) ) {
					copy( $item, $dest_path );
				} elseif ( ! file_exists( $dest_path ) ) {
					copy( $item, $dest_path );
				} else {
					$error = 1;
					WP_CLI::warning( "Unable to copy '" . $iterator->getSubPathName() . "' to current directory." );
				}
			}
		}

		if ( $error ) {
			throw new \Exception( 'There was an error overwriting existing files.' );
		}
	}
309323
private static function copy($src, $dest)
  {
    // 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;
      }
    }
    copy($src, "$dest/" . basename($src));
  }
104252
public static function copy(string $source, string $dest, bool $overwrite = true): void
	{
		NetteFileSystem::copy($source, $dest, $overwrite);
	}
1078178
protected function _move($source, $targetDir, $name) {
		$target = $this->_normpath($targetDir.'/'.$name);
		try {
			$this->dropbox->move($source, $target);
		} catch (Dropbox_Exception $e) {
			return $this->setError('Dropbox error: '.$e->getMessage());
		}
		$this->deltaCheck();
		return $target;
	}
637216
public function moveFrom(string $source): ?string
    {
        $ret = $this->handle->rpoplpush($source, $this->name);
        return (false === $ret) ? null : $ret;
    }
364819
public function copyDirs($source, $target, $dirs)
    {
        foreach ($dirs as $dir) {
            $this->copyDir($source, $target, $dir);
        }
    }
958696
public function put($src, $dest){
		if ( file_exists($src) &&
            ($dest = $this->checkFilePath($dest)) &&
            ftp_put($this->cn,$dest,$src,FTP_BINARY) ){
      return true;
		}
		return false;
	}
193617
protected function move($src, $dest, &$errors = 0, &$success = 0)
    {
        $this->copy($src, $dest, $errors, $success);

        if (empty($errors)) {
            gplcart_file_delete_recursive($src, $errors);
        }

        return empty($errors);
    }
69931
public function moveImage($source, $dest)
    {
        $this->ftp_mkdir_recur($dest);
        $bool = ftp_put($this->link, $dest, $source, FTP_BINARY);
        if (!$bool) $this->tips = 'move';
        return $bool;
    }
803510
public function moveFile($source, $target, $file)
    {
        if (file_exists($source.$file)) {
            rename($source.$file, $target.$file);
        }
    }
395852
public static function copy($source, $target)
    {
        if (false === is_dir($source)) {
            return copy($source, $target);
        }

        self::mkdir($target);

        $dirSource = dir($source);

        while (false !== ($fileEntry = $dirSource->read())) {
            if (true === in_array($fileEntry, self::getDirSymbols())) {
                continue;
            }

            if (false === self::copy(sprintf('%s/%s', $source, $fileEntry), sprintf('%s/%s', $target, $fileEntry))) {
                return false;
            }

        }

        $dirSource->close();

        return true;
    }