Move file

@param string $dest
@return void
970460
public function move(?string $dest = null)
  {
    if ($dest != null || $dest != '') {
      $path = $this->storage[$this->disc]['root'] . DIRECTORY_SEPARATOR . $this->cleanPath($dest);
      if (!$this->__dir($path)) throw new StorageUnusableException;
      $file = $path . DIRECTORY_SEPARATOR . $this->info['name'];
    } else {
      $file = $this->storage[$this->disc]['root'] . DIRECTORY_SEPARATOR . $this->info['name'];
    }

    if (file_exists($file)) {
      return [
        'status' => 'failed',
        'reason' => 'file already exists',
      ];
    }

    if (move_uploaded_file($this->info['tmp_name'], $file)) {

      /**
       * For some weird reason, sometimes files don't get
       * moved. So let's run this again and hope this file
       * will get moved
       */
      if (!file_exists($file)) {
        move_uploaded_file($this->info['tmp_name'], $file);
      }

      return [
        'status' => 'success',
        'path' => $file,
      ];
    }
    else {
      return [
        'status' => 'failed',
        'reason' => 'something went wrong',
      ];
    }
  }
939574
protected function recursivelyApply($data, &$dest)
    {
        Deprecation::notice('5.0', 'Use recursivelyApplyChanges() instead');
        foreach ($data as $k => $v) {
            if (is_array($v)) {
                if (!isset($dest[$k]) || !is_array($dest[$k])) {
                    $dest[$k] = array();
                }
                $this->recursivelyApply($v, $dest[$k]);
            } else {
                $dest[$k] = $v;
            }
        }
    }
1364427
public function setDestDir($destDir)
    {
        if ($destDir instanceof PhingFile) {
            $this->destDir = $destDir;
        } else {
            $this->destDir = new PhingFile($destDir);
        }
    }
200649
protected function copyTemplate($template, $dest)
    {
        $source = __DIR__.'/../../templates/'.$template;
        if (file_exists($source)) {
            return file_put_contents($dest, file_get_contents($source));
        }
    }
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;
    }
1368258
static function upToDate($src, $dest)
    {
        if (!file_exists($dest)) {
            return false;
        }

        if (filemtime($dest) >= filemtime($src)) {
            return true;
        }
        return false;
    }
77594
public function moveTo(string $destination): void
    {
        $destination = is_dir($destination) ? ("$destination/{$this->clientName}") : $destination;
        Filesystem::checkWritable(dirname($destination));
        if (!move_uploaded_file($this->path, $destination)) {
            throw new FilesystemException("Failed to move file {$this->path} to {$destination}");
        }
    }
1070473
public function export($path, $dest)
    {
        $head = $this->getHead();
        $branch = $head->getName();

        $this->dispatch(VcsEvents::PRE_EXPORT, new ExportEventData($head, $path, $dest));

        if (!$this->hasCheckout) {
            $this->checkout();
        }

        // we already have cloned the repository, use that instead
        $result = $this->execute('clone', array('-b' => (string) $branch, '--depth=1', 'file://' . $this->cwd, $dest), getcwd());

        $result = $this->adapter->execute('submodule', array('update', '--init' => true, '--recursive' => true), $dest);

        $filesystem = new Filesystem();
        $filesystem->remove($dest . '/.git');

        $this->dispatch(VcsEvents::POST_EXPORT, new ExportEventData($head, $path, $dest));
    }
916896
def move(src, dest, user=None):
    
    src_host, src_port, src_path = path.split(src, user)
    dest_host, dest_port, dest_path = path.split(dest, user)
    src_fs = hdfs(src_host, src_port, user)
    dest_fs = hdfs(dest_host, dest_port, user)
    try:
        retval = src_fs.move(src_path, dest_fs, dest_path)
        return retval
    finally:
        src_fs.close()
        dest_fs.close()
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);
        }
    }
38539
protected static function copyRecursive( $src, $dest )
	{
		self::createDirectory( $dest );

		$iterator = new \RecursiveIteratorIterator(
			new \RecursiveDirectoryIterator( $src, \RecursiveDirectoryIterator::SKIP_DOTS ),
			\RecursiveIteratorIterator::SELF_FIRST
		);

		foreach( $iterator as $item )
		{
			$target = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName();

			if( $item->isDir() === false )
			{
				if( copy( $item, $target ) === false ) {
					throw new \RuntimeException( sprintf( 'Unable to copy file "%1$s"', $item ) );
				}
			}
			else
			{
				self::createDirectory( $target );
			}
		}
	}
1196179
protected function copy($src, $dest)
    {
        if (!is_file($src) && !is_dir($src)) {
            return 'Source File or dir not found: ' . $src;
        }

        if (is_file($src)) {
            File::copy($src, $dest, true);
        } elseif (is_dir($src)) {
            Folder::copy($src, $dest, true);
        }

        return sprintf('Copy %s ===> %s', $src, $dest);
    }
761268
public function checkout($dest)
    {
        $this->wc = new WorkingCopy($this, $dest);

        $this->dispatch(VcsEvents::PRE_CHECKOUT, new CheckoutEventData($this->getHead(), $dest));

        $this->wc->checkout();

        $this->dispatch(VcsEvents::POST_CHECKOUT, new CheckoutEventData($this->getHead(), $dest));
    }
381306
public function save($dest='./')
  {
    $new_name = false;
    if ( substr($dest,-1) === '/' ){
      if ( is_dir($dest) ){
        $new_name = 0;
      }
    }
    else if ( is_dir($dest) ){
      $dest .= '/';
      $new_name = 0;
    }
    else if ( is_dir(substr($dest,0,strrpos($dest,'/'))) ){
      $new_name = 1;
    }
    if ( $new_name !== false ){
      if ( $new_name === 0 ){
        $dest .= $this->name;
      }
      if ( null !== $_FILES ){
        move_uploaded_file($this->file,$dest);
        $this->file = $dest;
        $this->uploaded = 1;
      }
      else{
        copy($this->file, $dest);
      }
    }
    return $this;
  }
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;
    }
1021224
public function get($src, $dest){
		if ( $src = $this->checkFilePath($src) &&
            ftp_get($this->cn, $dest, $src, FTP_BINARY) ){
      return true;
		}
		return false;
	}
623667
protected function copyFileWithDirsCreating($src, $dest)
    {
        $dirPathOfDestFile = dirname($dest);

        if (! File::exists($dirPathOfDestFile)) {
            File::makeDirectory($dirPathOfDestFile, 0755, true);
        }

        if (! File::exists($dest)) {
            File::copy($src, $dest);
        }
    }