Delete a file

@param string $path
@return bool
@access public
488913
function _unlink($path)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->delete($path, false);
    }
1081794
public function remove( $path )
    {
        if ( null === $this->identity )
        {
            return false;
        }

        if ( is_array( $path ) || is_object( $path ) )
        {
            $result = array();

            foreach ( $path as $key => $p )
            {
                $result[$key] = $this->remove( $p );
            }

            return $result;
        }

        $path = $this->realPath( $path );
        $base = $this->baseUrl . ( empty( $path ) ? '' : '/' . $path );
        $full = realpath( $this->baseDir . '/' . $base );

        if ( empty( $path ) ) // prevent delete root
        {
            return false;
        }

        $isDir  = is_dir( $full );
        $isFile = is_file( $full );

        if ( $isDir || $isFile )
        {
            $rights = $this->rights( $path );

            if ( $rights->delete )
            {
                switch ( true )
                {
                    case $isDir:
                        return $this->_rmdir( $full );

                    case $isFile:
                        return @ unlink( $full );
                }
            }
        }

        return false;
    }
900021
public function delete( $path = '' )
    {
        if ( empty( $path ) ) {
            $this->_value = [];
        }
        else {
            $path = str_replace( '/', '.', $path );
            $keys = explode( ".", $path );

            $lastKey = $keys[ count( $keys ) - 1 ];

            $array = &$this->_value;

            foreach ( $keys as $key ) {
                if ( $key == $lastKey ) {
                    unset( $array[ $key ] );
                    break;
                }
                $array = &$array[ $key ];
            }
        }
        $result = WpOption::updateOrCreate(
            ['option_name' => $this->optionsName],
            ['option_value' => json_encode( $this->_value )]
        );

        return $this->_value;
    }
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);
    }
1287190
public function remove($path)
    {
        $contents = $this->Acos->node($path);
        if (!$contents) {
            return false;
        }

        $content = $contents->first();
        $this->Acos->removeFromTree($content);
        $this->Acos->delete($content);

        return true;
    }
1303796
public function delete($path)
    {
        $result = $this->client->deleteObject([
            'Bucket' => $this->getBucket(),
            'Key'    => $path,
        ]);

        return (bool) $result;
    }
482559
public function delete($path)
    {
        $this->ftp->chdir($this->getDefaultPath());
        $result = $this->ftp->delete($path);
        if (!$result) {
            $files = $this->ftp->nlist($path);
            if ($files && is_array($files)) {
                foreach ($files as $file) {
                    $this->delete($file);
                }

                return $this->ftp->rmdir($path);
            }

            return false;
        }
    }
480729
private static function deleteDirectory($path = '')
    {
        $directory = dir($path);
        while (($item = $directory->read()) !== false) {
            if ($item == '.' || $item == '..') {
                continue;
            }
            $file = $directory->path . '/' . $item;
            if (is_dir($file)) {
                self::deleteDirectory($file);
                continue;
            }
            unlink($file);
        }
        $directory->close();
        rmdir($path);
    }
1336945
public function deleteDir($path)
    {
        $this->deleteContents($path);

        $location = $this->applyPathPrefix($path);

        try {
            $this->share->rmdir($location);
        } catch (NotFoundException $e) {
            return false;
        } catch (InvalidTypeException $e) {
            return false;
        }

        return true;
    }
658194
protected function deleteRecursive($path)
    {
        if (is_file($path) || is_link($path)) {
            return unlink($path);
        }
        $success = true;
        $dir = dir($path);
        while (($entry = $dir->read()) !== false) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            $entry_path = $path . '/' . $entry;
            $success = static::deleteRecursive($entry_path) && $success;
        }
        $dir->close();

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

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

		return $oFile->delete();
	}
214100
public function delete($path)
    {
        $object = $this->applyPathPrefix($path);

        try {
            $this->client->deleteObject($this->bucket, $object);
        } catch (OssException $e) {
            return false;
        }

        return true;
    }
378834
public function delete($path)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_delete($this->conn, $path) === false)
			{
				if (@ftp_rmdir($this->conn, $path) === false)
				{
					Log::add(__METHOD__ . 'Bad response.', Log::WARNING, 'jerror');

					return false;
				}
			}

			return true;
		}

		// Send delete file command and if that doesn't work, try to remove a directory
		if (!$this->_putCmd('DELE ' . $path, 250))
		{
			if (!$this->_putCmd('RMD ' . $path, 250))
			{
				Log::add(
					sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 250].  Path sent: %3$s', __METHOD__, $this->response, $path),
					Log::WARNING, 'jerror'
				);

				return false;
			}
		}

		return true;
	}
478062
public function delete($path)
    {
        $path = $this->applyPathPrefix($path);
        $object = $this->bucket->object($path);

        if (false === $object->exists()) {
            return true;
        }

        $object->delete();

        return !$object->exists();
    }
797769
public function delete($path)
    {
        $result = $this->client->deleteObject($this->bucket, $path);
        if (is_null($result)) {
            return false;
        }

        return true;
    }
417408
public function deleteFile($path)
    {
        $path = $this->cleanFolder($path);

        if ($this->checkFileExists($path)) {
            return $this->disk->delete($path);
        }

        return 'File does not exist.';
    }
981173
public function delete($path): bool
    {
        $result = false;
        $parts = $this->split($path);

        $name = array_shift($parts);
        if (!count($parts)) {
            if (isset($this->ownData[$name])) {
                unset($this->ownData[$name]);
                $result = true;
            }
        } elseif (isset($this->subTrees[$name])) {
            $subtree = $this->subTrees[$name];
            $result = $subtree->delete($parts);
            if ($result && !$subtree->count()) {
                unset($this->subTrees[$name]);
            }
        }

        return $result;
    }