Move (copy and delete) all files from one filesystem to another.

@param Filesystem $source
@param Filesystem $destination

@return void
761230
public function moveFiles(Filesystem $source, Filesystem $destination): void
    {
        foreach ($source->listContents() as $path) {
            if ($path['type'] === 'file') {
                $destination->put($path['path'], $source->read($path['path']));
                $source->delete($path['path']);

                if ($this->timeout_service->isTimeNearlyUp()) {
                    throw new InternalServerErrorException(I18N::translate('The server’s time limit has been reached.'));
                }
            }
        }
    }
571062
private function moveFile($sourceFolder, $destFolder, $filename)
    {
        // generate the full file paths
        $sourceFilepath = $sourceFolder . DIRECTORY_SEPARATOR . $filename;
        $destFilepath = $destFolder . DIRECTORY_SEPARATOR . $filename;

        // rename the file
        rename($sourceFilepath, $destFilepath);
    }
146982
public function moveFile($source, $destination)
    {
        @rename($source, $destination);

        if (!$this->isFileExist($destination)) {
            throw new EbayEnterprise_Catalog_Exception_Feed_File("Can not move $source to $destination");
        }
    }
351564
public function unzip($source, $destination)
    {
        @mkdir($destination, 0777, true);

        foreach ((array) glob($source.'/*.zip') as $key => $value) {
            if ($this->zip->open(str_replace('//', '/', $value)) === true) {
                $this->zip->extractTo($destination);
                echo $this->ZipStatusString($this->zip);
                $this->zip->close();
            }
        }
    }
389121
def move(self, source, destination):
        
        if source.isfile():
            source.copy(destination)
            source.remove()
        else:
            source.copy(destination, recursive=True)
            source.remove('r')
383689
protected function _copyDirectory($source, $destination)
    {
        $folder = new Folder($source);
        if ($folder->copy(['to' => $destination])) {
            $this->out('Copied assets to directory ' . $destination);

            return true;
        }

        $this->err('Error copying assets to directory ' . $destination);

        return false;
    }
1346781
public static function move($sourcePath, $destinationPath)
    {
        if (!self::exists($sourcePath)) {
            throw new FileNotFoundException('Cannot find source file: ' . $sourcePath);
        }
        return rename($sourcePath, $destinationPath);
    }
493639
public function move(FilesystemFolder $destination) {

		// already in destination folder, nothing to do

		if($destination !== $this->folder) {

			$oldpath	= $this->folder->getPath() . $this->filename;
			$newpath	= $destination->getPath() . $this->filename;
	
			if(@rename($oldpath, $newpath)) {

				$this->clearCacheEntries();
				
				// set new folder reference

				$this->folder = $destination;
	
				// re-read fileinfo

				$this->fileInfo	= new \SplFileInfo($newpath);

				self::$instances[$newpath] = $this;
				unset(self::$instances[$oldpath]);

				// @todo: check necessity of chmod
	
				@chmod($newpath, 0666 & ~umask());
				
			}
	
			else {
				throw new FilesystemFileException("Moving from '$oldpath' to '$newpath' failed.", FilesystemFileException::FILE_RENAME_FAILED);
			}

		}

		return $this;
	}
110281
public function copy( $source, $destination ) {

		$source = $this->get_file( $source );

		if ( false === $source ) {
			return false;
		}

		$destination_parent = $this->get_file( dirname( $destination ) );
		$filename = basename( $destination );

		if ( false === $destination_parent ) {
			return false;
		}

		$destination_parent->contents->$filename = clone $source;

		return true;
	}
1073920
private function copy($source, $target)
    {
        $files = $this->listFiles($source, $target);

        foreach ($files as $newPath => $oldPath) {
            if (!file_exists($newPath)) {
                if (is_dir($oldPath)) {
                    mkdir($newPath, 0755, true);
                } else {
                    copy($oldPath, $newPath);
                }
            }
        }
    }
331133
public function copy($destination)
  {
    $f = $this->getValue();

    if ($f) {
      $arr = pathinfo($destination);
      if ($f instanceof UploadedFile) {
        return $f->move($arr['dirname'], $arr['basename']);
      } else {
        if (!@copy($f->getRealPath(), $destination)) {
          $error = error_get_last();

          throw new FileException(
            sprintf(
              'Could not move the file "%s" to "%s" (%s)',
              $f->getPathname(),
              $destination,
              strip_tags($error['message'])
            )
          );
        }

        return new \Symfony\Component\HttpFoundation\File\File($destination);
      }
    }

    return false;
  }
1369809
protected function moveBetweenFilesystems($fileID, Filesystem $from, Filesystem $to)
    {
        foreach ($this->findVariants($fileID, $from) as $nextID) {
            // Copy via stream
            $stream = $from->readStream($nextID);
            $to->putStream($nextID, $stream);
            if (is_resource($stream)) {
                fclose($stream);
            }
            $from->delete($nextID);
        }

        // Truncate empty dirs
        $this->truncateDirectory(dirname($fileID), $from);
    }
173220
final public function setDestinationDirectory(string $destinationDirectory)
    {
        if ($destinationDirectory[strlen($destinationDirectory) - 1] != DIRECTORY_SEPARATOR) {
            $destinationDirectory .= DIRECTORY_SEPARATOR;
        }
        $this->destinationDirectory = $destinationDirectory;
    }
937569
public function MoveFolder($source,$dest){
        $this->CopyFiles($source,$dest);
        $this->RemoveFiles($source);
    }
533276
public function moveDirectory( $source, $destination )
    {
        $path = explode( DS, $source );

        $destination = $destination . DS . $path[ count( $path ) - 1 ];

        $result = $this->copyDirectory( $source, $destination, TRUE );

        if ( TRUE === $result )
        {
            $result = $this->deleteDirectory( $source );
        }

        return $result;
    }
803510
public function moveFile($source, $target, $file)
    {
        if (file_exists($source.$file)) {
            rename($source.$file, $target.$file);
        }
    }
497720
public function move(Config $source) {
		$files = $_FILES[$source->defaultFilesKey];
		/**
		 * @var $output File[]
		 */
		$output = [];

		try {
			if (isset($files) and is_array($files) and isset($files['name']) and is_array($files['name']) and count($files['name'])) {
				foreach ($files['name'] as $i => $file) {
					if ($files['error'][$i]) {
						throw new \Exception(isset(Helper::$upload_errors[$files['error'][$i]]) ? Helper::$upload_errors[$files['error'][$i]] : 'Error', $files['error'][$i]);
					}

					$path     = $source->getPath();
					$tmp_name = $files['tmp_name'][$i];
					$new_path = $path . Helper::makeSafe($files['name'][$i]);

					if (!move_uploaded_file($tmp_name, $new_path)) {
						if (!is_writable($path)) {
							throw new \Exception('Destination directory is not writeble', Consts::ERROR_CODE_IS_NOT_WRITEBLE);
						}

						throw new \Exception('No files have been uploaded', Consts::ERROR_CODE_NO_FILES_UPLOADED);
					}

					$file = new File($new_path);

					try {
						$this->accessControl->checkPermission($this->getUserRole(), $this->action, $source->getRoot(), pathinfo($file->getPath(), PATHINFO_EXTENSION));
					} catch (\Exception $e) {
						$file->remove();
						throw $e;
					}

					if (!$file->isGoodFile($source)) {
						$file->remove();
						throw new \Exception('File type is not in white list', Consts::ERROR_CODE_FORBIDDEN);
					}

					if ($source->maxFileSize and $file->getSize() > Helper::convertToBytes($source->maxFileSize)) {
						$file->remove();
						throw new \Exception('File size exceeds the allowable', Consts::ERROR_CODE_FORBIDDEN);
					}

					$output[] = $file;
				}
			}
		} catch (\Exception $e) {
			foreach ($output as $file) {
				$file->remove();
			}
			throw $e;
		}

		return $output;
	}