copy directory
@param  string $source path to source directory
@param  string $dest   pasy to destination directory
423510
public static function copyDirectory(string $source, string $dest)
    {
        if (!is_dir($dest)) {
            mkdir($dest, 0700, true);
        }
        if (is_dir($source) && ($dh = opendir($source))) {
            while (($file = readdir($dh)) !== false) {
                if ($file === '.' || $file === '..') {
                    continue;
                } elseif (is_dir("{$source}/{$file}")) {
                    self::copyDirectory("{$source}/{$file}", "{$dest}/{$file}");
                } else {
                    copy("{$source}/{$file}", "{$dest}/{$file}");
                }
            }
            closedir($dh);
        }
    }
1134964
private function copyDirectory(
        FilesystemInterface $source,
        FilesystemInterface $destination,
        $path
    ) {
        foreach ($source->listFiles($path) as $filePath) {
            $this->copyFile($source, $destination, $filePath);
        }
    }
166501
public static function copyRec($source, $dest) {
    if (is_file($source)) {
      $perms = fileperms($source);
      return copy($source, $dest) && chmod($dest, $perms);
    }
    if (!is_dir($source)) {
      $message = ObjectFactory::getInstance('message');
      throw new IllegalArgumentException($message->getText("Cannot copy %0% (it's neither a file nor a directory).", [$source]));
    }
    self::copyRecDir($source, $dest);
  }
1164142
public static function copy(String $source, String $target) : Bool
    {
        return Filesystem::copy(Info::rpath($source), Info::rpath($target));
    }
344073
public static function move($source, $des)
    {
        if (!is_file($source)) {
            return false;
        }
        try {
            @rename($source, $des);
            return true;
        } catch (\Exception $e) {
            return false;
        }
    }
90516
protected function copyFile($source, $dest)
    {
        // Ensure existing file can be overwritten
        if (file_exists($dest)) {
            $this->ensureWritable($dest);
        }
        file_put_contents($dest, file_get_contents($source));
    }
510716
public static function CopyFiles($source,$dest){
        File::mkfolders($dest);
        $folder = opendir($source);
        while($file = readdir($folder)){
            if ($file == '.' || $file == '..') continue;

            if(is_dir($source.'/'.$file)){
                mkdir($dest.'/'.$file,0777);
                $this->CopyFiles($source.'/'.$file,$dest.'/'.$file);
            }else copy($source.'/'.$file,$dest.'/'.$file);
        }
        closedir($folder);
        return 1;
    }
1195827
public function copyAs($dest)
    {
        $dest = rtrim($dest, '/') . '/';

        $copy = new Directory($dest, $this->adapter); // create the destination directory

        foreach ($this->fs()->find('*')->asArray() as $file) {
            $file->copyAs($dest . $file->name());
        }

        return $copy;
    }
259837
public function move($dest)
    {
        $this->copy($dest);
        $this->delete();
        $this->path = $dest;
    }
97323
public function copy(PhingFile $src, PhingFile $dest)
    {
        global $php_errormsg;

        if (!$src->isLink()) {
            parent::copy($src, $dest);
            return;
        }

        $srcPath = $src->getAbsolutePath();
        $destPath = $dest->getAbsolutePath();

        $linkTarget = $src->getLinkTarget();
        if (false === @symlink($linkTarget, $destPath)) {
            $msg = "FileSystem::copy() FAILED. Cannot create symlink from $destPath to $linkTarget.";
            throw new Exception($msg);
        }
    }
1153268
public function copy(TemporaryFile $source, string $destination): bool
    {
        $readStream = $source->readStream();

        if (realpath($destination)) {
            $tempStream = fopen($destination, 'rb+');
            $success    = stream_copy_to_stream($readStream, $tempStream) !== false;

            if (is_resource($tempStream)) {
                fclose($tempStream);
            }
        } else {
            $success = $this->put($destination, $readStream);
        }

        if (is_resource($readStream)) {
            fclose($readStream);
        }

        return $success;
    }
571061
public static function copy($src, $dest, $force = false)
	{
		if (is_dir($src)) {
			Dir::copy($src, $dest, $force);
		} elseif (is_file($src)) {
			File::copy($src, $dest, $force);
		}

		return true;
	}
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;
    }
60304
public function copy($src, $dest)
    {
        if (is_dir($src)) {
            $this->ensureDir($dest);
            $files = scandir($src);
            foreach ($files as $file) {
                if ($file !== '.' && $file !== '..') {
                    $this->copy($src . '/' . $file, $dest . '/' . $file);
                }
            }
        } else {
            $this->ensureDir(dirname($dest));

            copy($src, $dest);
        }
    }
392045
public function copy($source, $dest)
    {
        // Simple copy for a file
        if (is_file($source)) {
            if (file_exists($dest) && (!empty($this->options['overwrite']) || fileatime($source) < fileatime($dest))) {
                return true;
            }

            return copy($source, $dest);
        }

        // Make destination directory
        if (!is_dir($dest)) {
            @mkdir($dest, 0777, true);
        }

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

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

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

        return true;
    }
789441
public function copy($source, $dest)
    {
        if (!is_dir($source)) {
            $dest = $this->mkdir($dest);
            $files = $this->readDir($source);

            foreach ($files as $file) {
                if (is_dir($source.'/'.$file)) {
                    $this->copy($source.'/'.$file, $dest.'/'.$file);
                } else {
                    copy($source.'/'.$file, $dest.'/'.$file);
                }
            }
        } elseif (is_file($source)) {
            return copy($source, $dest);
        }

        return true;
    }
378414
public static function copy(string $source, string $destination, array $options = []) : bool {
		if (is_dir($source)) {
			// we need to skip directories
			if (!empty($options['skip_directories']) && in_array(basename($source), $options['skip_directories'])) {
				return true;
			}
			// open directory for reading
			$dir = opendir($source);
			if (!file_exists($destination)) {
				if (!self::mkdir($destination)) return false;
			}
			while (($file = readdir($dir)) !== false) {
				if ($file == '.' || $file == '..') continue;
				if (empty($options['skip_files']) || (!empty($options['skip_files']) && !in_array($file, $options['skip_files']))) {
					if (!self::copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file, $options)) return false;
				}
			}
			closedir($dir);
			return true;
		} else {
			return copy($source, $destination);
		}
	}