Remove file

@param  string  $path  file path
@return bool
@author Dmitry (dio) Levashov
517281
protected function _unlink($path) {
		try {
			$this->dropbox->delete($path);
		} catch (Dropbox_Exception $e) {
			return $this->setError('Dropbox error: '.$e->getMessage());
		}
		$this->deltaCheck();
		return true;
	}
188526
public static function removeFileName($path)
    {
        $parts = explode(DIRECTORY_SEPARATOR, static::normalizePath($path));

        array_pop($parts);

        return implode(DIRECTORY_SEPARATOR, $parts);
    }
732389
public static function remove($path)
    {
        $path = self::resolve($path);

        return $path && is_file($path) && unlink($path);
    }
488913
function _unlink($path)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->delete($path, false);
    }
664259
private function removeExpired($path)
	{
		if ($this->autoremove) {
			$now = new DateTime;
			$file_date = new DateTime('@' . filemtime($path));
			$file_date->setTimezone($now->getTimezone());
			$remove_date = $now->modify($this->autoremove);
			if ($file_date < $remove_date) {
				unlink($path);
				return TRUE;
			}
		}

		return FALSE;
	}
108724
static function remove($path, $onlyFiles=false) {
		if (!file_exists($path)) {
			return true;
		}
		if (is_dir($path)) {
			if ($onlyFiles) throw new FileException("$path is a directory!");
			return self::removeDir($path);
		}
		else {
			$ok=unlink($path);
			if (!$ok) throw new FileAccessException("Could not delete file $path");
		}
		return true;
	}
1251508
protected function removeDirectory($path)
    {
        $files = glob($path . '/*');
        foreach ($files as $file) {
            if (is_dir($file)) {
                static::removeDirectory($file);
            } else if (basename($file) !== '.gitignore') {
                unlink($file);
            }
        }
        if ($path !== $this->cacheRoot) {
            rmdir($path);
        }

        return;
    }
828011
public static function RemoveFolder($Path) {
      if (!file_exists($Path))
         return;

      if (is_file($Path)) {
         unlink($Path);
         return;
      }

      $Path = rtrim($Path, '/').'/';

      // Get all of the files in the directory.
      if ($dh = opendir($Path)) {
         while (($File = readdir($dh)) !== false) {
            if (trim($File, '.') == '')
               continue;

            $SubPath = $Path.$File;

            if (is_dir($SubPath))
               self::RemoveFolder($SubPath);
            else
               unlink($SubPath);
         }
         closedir($dh);
      }
      rmdir($Path);
   }
590451
private function removeFileExtensionFromPath($path)
    {
        if (strrpos($path, '.') !== false) {
            $path = substr($path, 0, strrpos($path, '.'));
        }

        return $path;
    }
936390
protected function _removeMarkerFile($path) {
		if (empty($path)) {
			return false;
		}

		$oFile = new File($path, false);
		if (!$oFile->exists()) {
			return false;
		}

		return $oFile->delete();
	}
809395
public function remove_path($path)
	{
		foreach ($this->paths as $i => $p)
		{
			if ($p === $path)
			{
				unset($this->paths[$i]);
				break;
			}
		}

		return $this;
	}
1212457
public static function remove($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }
        return unlink($path);
    }
1118116
public function removeDir($path)
    {
        if ($path == 'packages' or $path == '/') {
            return false;
        }

        $files = array_diff(scandir($path), ['.', '..']);
        foreach ($files as $file) {
            if (is_dir("$path/$file")) {
                $this->removeDir("$path/$file");
            } else {
                @chmod("$path/$file", 0777);
                @unlink("$path/$file");
            }

        }
        return rmdir($path);
    }
1019216
private function remove_dir($path){
        if( is_dir($path) ){
            foreach( scandir($path) as $file ){
                if( $file != '.' && $file != '..' ){
                    if( is_dir("{$path}/{$file}") ){
                        $this->remove_dir("{$path}/{$file}");
                    }else{
                        @unlink("{$path}/{$file}");
                    }
                }
            }
            @rmdir($path);
        }
    }
1133840
public static function deleteDirectory($path)
    {
        if (!is_dir($path)) {
            return false;
        }

        $files = array_diff(scandir($path), ['.', '..']);
        foreach ($files as $file) {
            $inner_file = static::join($path, $file);
            if (is_dir($inner_file)) {
                // Delete inner directory recursive
                static::deleteDirectory($inner_file);
            } else {
                // Delete file
                unlink($inner_file);
            }
        }

        return rmdir($path);
    }
752055
public function delete($path)
    {
        try{
            $this->getOss()->deleteObject($this->bucket, $path);
            return true;
        }catch (OssException $e){

        }
        return false;
    }
742968
public function deleteOnce( string $path ): bool
	{
		try {
			if( ! @ unlink( $path ) ) throw new ErrorException;
		}
		catch( ErrorException $e )
		{
			return false;
		}

		return true;
	}