Deletes current file
@return sFire\System\File
543039
public function delete() {

		if(false !== $this -> file -> getExists()) {

			if(unlink($this -> file -> getBasepath())) {
				$this -> refresh();
			}
		}

		return $this;
	}
1230290
public function delete()
    {
        if (isset($this->onDelete)) {
            return call_user_func($this->onDelete, $this);
        }

        return $this->toBase()->delete();
    }
522528
public function preDelete()
    {
        $attId = $this->id();
        $joinProto = $this->modelFactory()->get(Join::class);
        $loader = $this->collectionLoader();
        $loader->setModel($joinProto);

        $collection = $loader->addFilter('attachment_id', $attId)->load();

        foreach ($collection as $obj) {
            $obj->delete();
        }

        return parent::preDelete();
    }
329418
public function clear()
	{
		$filePath = $this->options['file.path'];
		$this->checkFilePath($filePath);

		$iterator = new \RegexIterator(
			new \RecursiveIteratorIterator(
				new \RecursiveDirectoryIterator($filePath)
			),
			'/\.data$/i'
		);

		/* @var  \RecursiveDirectoryIterator  $file */
		foreach ($iterator as $file)
		{
			if ($file->isFile())
			{
				@unlink($file->getRealPath());
			}
		}

		return true;
	}
451453
public function delete()
  {
    if ( $this->file ){
      unlink($this->file);
    }
    $this->file = false;
    return $this;
  }
936818
public function onBeforeDelete()
    {
        $currentVersion = $this->owner->CurrentVersion();

        // make sure there actually is a current version, otherwise we're going
        // to end up deleting a bunch of incorrect stuff!
        if ($currentVersion && $currentVersion->ID > 0) {
            $folder = dirname($this->owner->CurrentVersion()->getFullPath());

            if ($versions = $this->owner->Versions()) {
                foreach ($versions as $version) {
                    $version->delete();
                }
            }

            if (is_dir($folder)) {
                Filesystem::removeFolder($folder);
            }

            // If the _versions folder is now empty - because there are no other versions of any assets - then we can
            // delete the _versions folder
            $folder = dirname($folder); // We want the parent of $folder, as we just deleted $folder
            if (is_dir($folder)) {
                $dir = opendir($folder);
                $foundOtherFile = false;

                while ($file = readdir($dir)) {
                    if (($file == '.' || $file == '..')) {
                        continue;
                    }
                    $foundOtherFile = true;
                }

                if (!$foundOtherFile) {
                    // No other files found, so we can delete the _versions folder
                    rmdir($folder);
                }
            }
        }
    }
754319
public function delete()
    {
        if (isset($this->onDelete)) {
            return call_user_func($this->onDelete, $this);
        }

        return $this->query->delete();
    }
1262007
public function Delete ()
	{
		
		// If there is a file and path
		
		if ($this->path && $this->filename)
		{
			
			// Delete file
			
			return self::_Delete ($this->path . $this->filename);
			
		}
		
		// Return TRUE
		
		return TRUE;
		
	}
447403
protected function deleteAlbumDir() {
		$tmpfile = new ElggFile();
		$tmpfile->setFilename('image/' . $this->guid . '/._tmp_del_tidypics_album_');
		$tmpfile->subtype = TidypicsImage::SUBTYPE;
		$tmpfile->owner_guid = $this->owner_guid;
		$tmpfile->container_guid = $this->guid;
		$tmpfile->open("write");
		$tmpfile->write('');
		$tmpfile->close();
		$tmpfile->save();
		$albumdir = preg_replace('#/._tmp_del_tidypics_album_#i', '', $tmpfile->getFilenameOnFilestore());
		$tmpfile->delete();

		// sanity check: must be a directory
		if (!$handle = opendir($albumdir)) {
			return false;
		}

		// loop through all files that might still remain undeleted in this directory and delete them
		// note: this does not delete the corresponding image entities from the database
		while (($file = readdir($handle)) !== false) {
			if (in_array($file, ['.', '..'])) {
				continue;
			}
			$path = "$albumdir/$file";
			unlink($path);
		}

		// remove empty directory
		closedir($handle);
		return rmdir($albumdir);
	}
973923
public function clearFile()
    {
        $cleared = false;

        if (isset($this->file_pointer)) {
            $cleared = $this->file_pointer->ftruncate(0);
        }

        return $cleared;
    }
676025
protected function getFilesToDelete()
    {
        $dirName    = dirname($this->baseFilename);
        $baseName   = basename($this->baseFilename);
        $fileNames  = scandir($dirName);
        $result     = array();
        $prefix     = $baseName . '.';
        $plen       = strlen($prefix);

        foreach ($fileNames as $fileName) {
            if ($fileName == '.' || $fileName == '..') {
                continue;
            }

            if (!strncmp($fileName, $prefix, $plen)) {
                $suffix = substr($fileName, $plen);
                if (preg_match($this->extMatch, $suffix)) {
                    $result[] = $dirName . DIRECTORY_SEPARATOR . $fileName;
                }
            }
        }

        sort($result);
        $rlen = count($result);
        if ($rlen < $this->backupCount) {
            $result = array();
        } else {
            $result = array_slice($result, 0, $rlen - $this->backupCount);
        }
        return $result;
    }
299128
public function actionFileRemove() {
		$source = $this->getSource();

		$file_path = false;

		$path = $source->getPath();

		$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);

		$target = $this->request->name;

		if (
			realpath($path . $target) &&
			strpos(realpath($path . $target), $source->getRoot()) !== false
		) {
			$file_path = realpath($path . $target);
		}

		if (!$file_path || !file_exists($file_path)) {
			throw new \Exception('File or directory not exists ' . $path . $target, Consts::ERROR_CODE_NOT_EXISTS);
		}

		if (is_file($file_path)) {
			$file = new File($file_path);
			if (!$file->remove()) {
				$error = (object)error_get_last();
				throw new \Exception('Delete failed! ' . $error->message, Consts::ERROR_CODE_IS_NOT_WRITEBLE);
			}
		} else {
			throw new \Exception('It is not a file!', Consts::ERROR_CODE_IS_NOT_WRITEBLE);
		}
	}
300645
public function deleteFiles()
    {
        if ($this->isAbsolute()) {
            if ($this->isDir()) {
                // delete files in the current directory
                return $this->deleteFilesAction($this->getPathname(), false);
            } else {
                throw new FileException('Given path is a file and not a directory.');
            }
        } else {
            throw new FileException('Given file path is not a absolute path.');
        }
    }
988673
public function destroy()
    {
        $this->contents = [];
        $filepath = $this->getFilepath();

        if ($this->getFilesystem()->has($filepath)) {
            return $this->getFilesystem()->delete($filepath);
        }
    }
392826
public function delete()
  {
    $file = $this->file;

    if (file_exists($file)) return Filesystem::delete($file);

    return false;
  }
476226
public function clear()
    {
        $key = $this->key();
        $files = glob($this->path . "/_cache-" . $key . "*.cache");
        $this->setKey();
        $this->key(true);
        foreach ($files as $file) {
            unlink($file);
        }
        return $this;
    }
537617
public function delete()
    {
        // call CommonMixin function
        $result = $this->sendDelete($this->handle, $this->api_key, $this->security);
        return $result;
    }