@param string $from
@param string $to

@return bool

@throws Exceptions\PermissionDenied
@throws NotFound\Path
482560
public static function download($from, $to): bool
    {
        /**
         * @var bool|resource $fromStream
         */
        $fromStream = File::open($from);

        if (!is_resource($fromStream))
        {
            throw new NotFound\Path('Stream `' . $from . '` not found');
        }

        if (!File::real($to) && !File::touch($to))
        {
            throw new Exceptions\PermissionDenied('File `' . $to . '`');
        }

        File::put($to, $fromStream);

        return File::close($fromStream);
    }
208256
public function rename($from, $to)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_rename($this->conn, $from, $to) === false)
			{
				Log::add(__METHOD__ . 'Bad response.', Log::WARNING, 'jerror');

				return false;
			}

			return true;
		}

		// Send rename from command to the server
		if (!$this->_putCmd('RNFR ' . $from, 350))
		{
			Log::add(
				sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 350].  From path sent: %3$s', __METHOD__, $this->response, $from),
				Log::WARNING, 'jerror'
			);

			return false;
		}

		// Send rename to command to the server
		if (!$this->_putCmd('RNTO ' . $to, 250))
		{
			Log::add(
				sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 250].  To path sent: %3$s', __METHOD__, $this->response, $to),
				Log::WARNING, 'jerror'
			);

			return false;
		}

		return true;
	}
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;
    }
366409
public function moveDirectory( $from, $to, $overwrite = false )
	{
		if ( $overwrite && $this->isDirectory( $to ) )
		{
			$this->deleteDirectory( $to );

			$this->copyDirectory( $from, $to );

			$this->deleteDirectory( $from );

			return true;
		}

		return @rename( $from, $to ) === true;
	}
49654
protected function generateRelativePath($from, $to)
    {
        // some compatibility fixes for Windows paths
        $from = is_dir($from) ? rtrim($from, '\/').'/' : $from;
        $to = is_dir($to)   ? rtrim($to, '\/').'/'   : $to;
        $from = str_replace('\\', '/', $from);
        $to = str_replace('\\', '/', $to);

        $from = explode('/', $from);
        $to = explode('/', $to);
        $from2 = array();
        foreach ($from as $key => $value) {
            if ($value === '..') {
                unset($from2[$key - 1]);
            } else {
                $from2[] = $value;
            }
        }
        $from = $from2;
        $relPath = $to;

        foreach ($from as $depth => $dir) {
            // find first non-matching dir
            if ($dir === $to[$depth]) {
                // ignore this directory
                array_shift($relPath);
            } else {
                // get number of remaining dirs to $from
                $remaining = count($from) - $depth;

                if ($remaining > 1) {
                    // add traversals up to first matching dir
                    $padLength = (count($relPath) + $remaining) * -1;

                    $relPath = array_pad($relPath, $padLength, '..');
                    break;
                } else {
                    $relPath[0] = './'.$relPath[0];
                }
            }
        }

        return implode('/', $relPath);
    }
837409
public function move($from, $to)
    {
        event(new Events\FileMoving($from, $to));
        $moved = $this->disk()->move($from, $to);
        event(new Events\FileMoved($from, $to, $moved));

        return $moved;
    }
721935
public static function move($from, $to)
    {
        return self::copy($from, $to) && self::delete($from);
    }
703253
protected function getRelativePath($from, $to)
    {
        $from = explode('/', str_replace('\\', '/', $from));
        $to = explode('/', str_replace('\\', '/', $to));

        foreach ($from as $depth => $dir) {
            if (isset($to[$depth]) && $dir === $to[$depth]) {
                unset($to[$depth], $from[$depth]);
            }
        }

        for ($i = 0; $i < count($from) - 1; $i++) {
            array_unshift($to, '..');
        }

        return implode('/', $to);
    }
140488
public function byRevision(string $from, string $to = ''): Log
    {
        $this->since = ' ' . escapeshellarg($from) . '..'
                     . (empty($to) ? '' : escapeshellarg($to));
        return $this;
    }
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;
	}
967932
private static function getRelativePath($from, $to)
    {
        // some compatibility fixes for Windows paths
        $from = is_dir($from) ? rtrim($from, '\/') . DIRECTORY_SEPARATOR : $from;
        $to = is_dir($to) ? rtrim($to, '\/') . DIRECTORY_SEPARATOR : $to;
        $from = str_replace('\\', DIRECTORY_SEPARATOR, $from);
        $to = str_replace('\\', DIRECTORY_SEPARATOR, $to);

        $from = explode(DIRECTORY_SEPARATOR, $from);
        $to = explode(DIRECTORY_SEPARATOR, $to);
        $relPath = $to;

        $relPath = self::calculateRelativePath($from, $to, $relPath);
        $relPath = implode(DIRECTORY_SEPARATOR, $relPath);
        $relPath = self::removePointerToCurrentDir($relPath);
        return $relPath;
    }
922009
static public function getRelPath($from, $to)
    {
        $returnValue = (string) '';

        $from = is_dir($from) ? $from : dirname($from);
        $arrFrom = explode(DIRECTORY_SEPARATOR, rtrim($from, DIRECTORY_SEPARATOR));
        $arrTo = explode(DIRECTORY_SEPARATOR, rtrim($to, DIRECTORY_SEPARATOR));

        while (count($arrFrom) && count($arrTo) && ($arrFrom[0] == $arrTo[0])) {
            array_shift($arrFrom);
            array_shift($arrTo);
        }
        foreach ($arrFrom as $dir) {
            $returnValue .= '..' . DIRECTORY_SEPARATOR;
        }
        $returnValue .= implode(DIRECTORY_SEPARATOR, $arrTo);

        return (string) $returnValue;
    }
900406
public static function routeParse($from, $to, $url)
    {
        // validation and parse route pattern
        $result = preg_match('/^(\(([^\)]+)\)|[^\/]*)(.*)/', $from, $data);

        if ($result !== 1) {
            return false;
        }

        // prepare patter to test url and replacement
        $pattern = '/^' . str_replace('/', '\/', $data[3]) . '$/';

        // test route pattern match
        $result = preg_match($pattern, $url);

        if ($result !== 1) {
            return false;
        }

        // create RouteInfo object and fill fields
        $route = new RouteInfo();
        // make array of supported methods
        $route->methods = empty($data[2]) ? [] : explode('|', $data[2]);
        // replace pattern url
        $route->url = preg_replace($pattern, $to, $url);

        return $route;
    }
849545
public function moveFile( $from, $to )
	{
		$this->connection->checkConnection();
		return @ftp_rename( $this->connection->getResource(), $from, $to );
	}
409358
public function copyDir($from,$to,Finder $finder)
    {
        /* @var \Symfony\Component\Finder\SplFileInfo $path */

        $finder->in($from);
        foreach ($finder->files() as $path) {
            $targetDir = $to.DIRECTORY_SEPARATOR.$path->getRelativePath();
            if (!is_dir($targetDir)) {
                mkdir($targetDir,0755,true);
            }
            $target = $to.DIRECTORY_SEPARATOR.$path->getRelativePathname();
            copy($path->getRealPath(),$target);
        }
    }
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;
    }
763099
public function copy(string $from, string $to, array $config = []): bool
    {
        list($prefixFrom, $from) = $this->getPrefixAndPath($from);

        if (($buffer = $this->getFileSystem($prefixFrom)->readStream($from)) === false) {
            return false;
        }

        unset($prefixFrom, $from);

        list($prefixTo, $to) = $this->getPrefixAndPath($to);

        if ($this->getFileSystem($prefixTo)->writeStream($to, $buffer, $config)) {
            unset($prefixTo, $to, $buffer);
            return true;
        }

        return false;
    }