Copy a file to a new location.

@param  string $from
@param  string $to
@return bool
776105
public function copy($from, $to)
    {
        return $this->filesystem->copy(
            $this->path($from),
            $this->path($to)
        );
    }
1068792
private function copyDir($from, $to)
    {
        mkdir($to, 0777, true);
        
        $items = new FilesystemIterator($from);

        foreach ($items as $item)
        {
            $pattern = preg_quote($from, "/");
            $Key = preg_replace("/^{$pattern}/", "", $item);

            $subFrom = strval($item);
            $subTo   = $to.$Key;
            
            if (filetype($item) == 'dir')
            {
                $this->copyDir($subFrom, $subTo);
            } else {
                $this->copyFile($subFrom, $subTo);
            }
        }

        return true;
    }
557641
public function move($from, $to, $type='sandbox')
	{
		$url = 'https://api.dropbox.com/1/fileops/move';
		$params = array('from_path' => $from,'to_path'=>$to);
		$result = $this->doOAuthCall($url, 'POST', $params, $type);
		$result_body = json_decode($result['body'], true);
		if (!array_key_exists('error', $result_body)) {
			return $result_body;
		} else {
			trigger_error(sprintf(self::E_APIERROR, $result_body['error']));
			return false;
		}
	}
1076692
protected function publishFile($from, $to)
    {
        if (! $this->files->exists($to) || $this->option('force')) {
            $this->createParentDirectory(dirname($to));

            $this->files->copy($from, $to);

            $this->status($from, $to, 'File');
        }
    }
739221
public function rename($from, $to)
    {
        // TODO: add directories support

        $contents = self::cache()->get($from);
        if (false === $contents) {
            return false;
        }

        self::cache()->delete($from);
        self::cache()->set($to, $contents);

        return true;
    }
1087099
public function renameFolder($from, $to)
    {
        $result = $this->execute('RENAME', array($this->escape($from), $this->escape($to)),
            self::COMMAND_NORESPONSE);

        return $result == self::ERROR_OK;
    }
167468
private function copyFromTo($from, $to)
    {
        $directory = dirname($to);
        if (!is_dir($directory)) {
            mkdir($directory, 0777, true);
        }

        copy($from, $to);
    }
942658
public static function copyDirRecursively($from, $to)
    {
        if (! $path = self::getFilesFromDir($from)) {
            return false;
        }

        self::createDir($to = rtrim($to, '/') . '/');

        foreach ($path as $file) {
            if ($file->isFile()) {
                if (! copy($file->getRealPath(), $to . $file->getFilename())) {
                    return false;
                }
            } elseif (! $file->isDot() && $file->isDir()) {
                self::copyDirRecursively($file->getRealPath(), $to . $path);
            }
        }

        return true;
    }
812854
protected function publishFile($from, $to)
    {
        if ($this->files->exists($to) && ! $this->option('force')) {
            return;
        }

        $directory = dirname($to);

        if (! $this->files->isDirectory($directory)) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        $this->files->copy($from, $to);

        $this->status($from, $to, 'File');
    }
1217501
public function deleteByRange($from, $to)
    {
        DB::beginTransaction();
        try {
            $from = $from . ' 00:00:00';
            $to   = $to . ' 23:59:59';
            $logs = Logs::whereBetween('created_at', [$from, $to]);
            $logs->delete();
        } catch (Exception $ex) {
            Log::alert($ex);
            DB::rollback();
            return false;
        }
        DB::commit();
        return true;
    }
605997
public function copyFolder( $from, $to )
	{
		$this->connection->checkConnection();
		$this->createFolder( $to );
		$reader	= new Net_FTP_Reader( $this->connection );
		$list	= $reader->getList( $from, TRUE );
		foreach( $list as $entry )
		{
			if( $entry['isdir'] )
				$this->createFolder( $to."/".$entry['name'] );
			else
				$this->copyFile( $from."/".$entry['name'], $to."/".$entry['name'] );
		}
		return TRUE;
	}
452969
public function remount($from, $to)
    {
        $body = compact('from', 'to');

        $params = [
            'body' => json_encode($body)
        ];

        return $this->client->post('/v1/sys/remount', $params);
    }
771486
protected function fromTo($command, $from, $destination)
    {
        $folder = dirname($destination);
        if (!$this->fileExists($folder)) {
            $this->createFolder($folder);
        }

        return $this->modulable->run(sprintf('%s %s %s', $command, $from, $destination));
    }
1113088
public function move($from, $to, array $config = [])
    {
        list($prefixFrom, $pathFrom) = $this->getPrefixAndPath($from);
        list($prefixTo, $pathTo) = $this->getPrefixAndPath($to);

        if ($prefixFrom === $prefixTo) {
            $filesystem = $this->getFilesystem($prefixFrom);
            $renamed = $filesystem->rename($pathFrom, $pathTo);

            if ($renamed && isset($config['visibility'])) {
                return $filesystem->setVisibility($pathTo, $config['visibility']);
            }

            return $renamed;
        }

        $copied = $this->copy($from, $to, $config);

        if ($copied) {
            return $this->delete($from);
        }

        return false;
    }
969399
protected function moveUploadedFile($from, $to)
    {
        return $this->unitTest ? copy($from, $to) : @move_uploaded_file($from, $to);
    }
268340
public function alias($from, $to = null)
	{
		if (is_array($from))
		{
			$this->aliases = array_merge($this->aliases, $from);

			return $this;
		}

		$this->aliases[$from] = $to;
		$this->cache->set($from, $to);
	}
589049
public function cloneContentFile($file, $fromId, $toId) {
    // Determine source path
    if ($fromId === 'editor') {
      $sourcepath = $this->getEditorPath();
    }
    else {
      $sourcepath = "{$this->path}/content/{$fromId}";
    }
    $sourcepath .= '/' . $file;

    // Determine target path
    $filename = basename($file);
    $filedir = str_replace($filename, '', $file);
    $targetpath = "{$this->path}/content/{$toId}/{$filedir}";

    // Make sure it's ready
    self::dirReady($targetpath);

    $targetpath .= $filename;

    // Check to see if source exist and if target doesn't
    if (!file_exists($sourcepath) || file_exists($targetpath)) {
      return; // Nothing to copy from or target already exists
    }

    copy($sourcepath, $targetpath);
  }