public static function copy($source, $dest, $overwrite = false)
	{
		list($source, $sourceName, $sourceMount) = self::parseLocation($source);
		list($dest,   $destName,   $destMount)   = self::parseLocation($dest);

		// Make sure we got the mounts we need
		if (!$sourceMount)
		{
			throw new \Exception("'{$sourceMount}' has not been mounted", 500);
		}

		if (!$destMount)
		{
			throw new \Exception("'{$destMount}' has not been mounted", 500);
		}

		// Check to see if destination already exists
		if ($destMount->has(self::getRelativePath($dest)))
		{
			if ($overwrite)
			{
				$destMount->delete(self::getRelativePath($dest));
			}
			else
			{
				return true;
			}
		}

		// Create mount manager
		$manager = new \League\Flysystem\MountManager([
			$sourceName => $sourceMount,
			$destName   => $destMount
		]);

		// Do copy
		return $manager->copy($source, $dest);
	}
public static function copy($source, $dest, $overwrite = false)
	{
		list($source, $sourceName, $sourceMount) = self::parseLocation($source);
		list($dest,   $destName,   $destMount)   = self::parseLocation($dest);

		// Make sure we got the mounts we need
		if (!$sourceMount)
		{
			throw new \Exception("'{$sourceMount}' has not been mounted", 500);
		}

		if (!$destMount)
		{
			throw new \Exception("'{$destMount}' has not been mounted", 500);
		}

		// Check to see if destination already exists
		if ($destMount->has(self::getRelativePath($dest)))
		{
			if ($overwrite)
			{
				$destMount->delete(self::getRelativePath($dest));
			}
			else
			{
				return true;
			}
		}

		// Create mount manager
		$manager = new \League\Flysystem\MountManager([
			$sourceName => $sourceMount,
			$destName   => $destMount
		]);

		// Do copy
		return $manager->copy($source, $dest);
	}
public static function copy ( $ source , $ dest , $ overwrite = false ) { list ( $ source , $ sourceName , $ sourceMount ) = self :: parseLocation ( $ source ) ; list ( $ dest , $ destName , $ destMount ) = self :: parseLocation ( $ dest ) ; // Make sure we got the mounts we need if ( ! $ sourceMount ) { throw new \ Exception ( "'{$sourceMount}' has not been mounted" , 500 ) ; } if ( ! $ destMount ) { throw new \ Exception ( "'{$destMount}' has not been mounted" , 500 ) ; } // Check to see if destination already exists if ( $ destMount -> has ( self :: getRelativePath ( $ dest ) ) ) { if ( $ overwrite ) { $ destMount -> delete ( self :: getRelativePath ( $ dest ) ) ; } else { return true ; } } // Create mount manager $ manager = new \ League \ Flysystem \ MountManager ( [ $ sourceName => $ sourceMount , $ destName => $ destMount ] ) ; // Do copy return $ manager -> copy ( $ source , $ dest ) ; }
Copys file from one location to another, between mounts

@param   mixed  $source     The source path or object
@param   mixed  $dest       The destination path or object
@param   bool   $overwrite  Whether or not to overwrite any existing files by the same name
@return  bool
Copys file from one location to another between mounts