Delete File from path

@param FileNameProcessor $file
186997
public static function DeleteFilesFromPath($file)
	{
		$files = self::RetrieveFilesFromFolder($file->PathSuggested(),null);
		foreach ($files as $f)
		{
			if (strpos($f,$file->Extension())!== false)
			{
				self::DeleteFileString($f);
			}
		}
	}
255050
protected static function _secureDelete($file)
    {
        if (isset($ptr['secure'][$file])) {
            $filesize = filesize($file);
            $fp = fopen($file, 'r+');
            foreach (self::$patterns as $pattern) {
                $pattern = substr(str_repeat($pattern, floor($filesize / strlen($pattern)) + 1), 0, $filesize);
                fwrite($fp, $pattern);
                fseek($fp, 0);
            }
            fclose($fp);
        }

        @unlink($file);
    }
584407
public static void deleteFile(@NonNull File file) {
    boolean deleted = file.delete();
    if (!deleted) {
      Log.w(LOG_TAG, "Could not delete file: " + file);
    }
  }
949756
public void delete(String fileName) {
		try {
			synchronized (prepareAnchor(fileName)) {
				// Close file, if it was opened
				IoChannel fileChannel = openFiles.remove(fileName);
				if (fileChannel != null)
					fileChannel.close();

				// Delete the file
				boolean hasDeleted = new File(dbDirectory, fileName).delete();
				if (!hasDeleted && logger.isLoggable(Level.WARNING))
					logger.warning("cannot delete file: " + fileName);
			}
		} catch (IOException e) {
			if (logger.isLoggable(Level.WARNING))
				logger.warning("there is something wrong when deleting " + fileName);
			e.printStackTrace();
		}
	}
1238215
public static function delete($file)
	{
		$files = (array) $file;

		foreach ($files as $file) {
			$file = FileHelper::cleanPath($file);

			// Try making the file writable first. If it's read-only, it can't be deleted
			// on Windows, even if the parent folder is writable
			@chmod($file, 0777);

			// In case of restricted permissions we zap it one way or the other
			// as long as the owner is either the webserver or the ftp
			if (!@ unlink($file)) {
				throw new Exception(__METHOD__ . ': Failed deleting ' . basename($file));
			}
		}

		return true;
	}
965193
protected function _removeFile($file)
    {
        $_file = new File($file);

        if ($_file->exists()) {
            $_file->delete();

            $folder = $_file->folder();
            if (count($folder->find()) === 0) {
                $folder->delete();
            }
            return true;
        }
        return false;
    }
655793
public static void delete(FileSystem fs, String name) throws IOException {
    Path dir = new Path(name);
    Path data = new Path(dir, DATA_FILE_NAME);
    Path index = new Path(dir, INDEX_FILE_NAME);

    fs.delete(data, true);
    fs.delete(index, true);
    fs.delete(dir, true);
  }
1092093
public function delete($namefiles,$path){
        if(is_string($namefiles)){
            $namefile = $this->sanitize($namefiles);
            $fullpath = $this->getFullPath().$path;
            $namefile = $this->clearNameFile($namefile);
            $file = new Filesystem;
            if($this->validNameFile($namefile,false) && $file->exists($fullpath.$namefile)){
                if( $this->config['debug'] ) $this->_log('$fullpath.$namefile - '.$fullpath.$namefile);
                if(is_dir($fullpath.$namefile)){
                    $file->remove($fullpath.$namefile);
                    $file->remove($this->getFullPath().'/'.$this->config['folder_thumb'].$path.$namefile);
                    $result = array("query"=>"BE_DELETE_DELETED","params"=>array());
                    $this->setInfo(array("msg"=>$result));
                }elseif($this->validNameFile($namefile) && is_file($fullpath.$namefile)){
                    $file2 = new \SplFileInfo($fullpath.$namefile);
                    $filename = $file2->getFilename();
                    foreach ($this->config['images']['resize'] as $key => $value) {
                        $image_info = $this->imageSizeName($path,$filename,$value);
                        $filename_new = $image_info['name'];
                        $fullpaththumb_name = $this->getFullPath().'/'.$this->config['folder_thumb'].$path.$filename_new;
                        $file->remove($fullpaththumb_name);
                    }
                    $file->remove($fullpath.$namefile);
                    $result = array("query"=>"BE_DELETE_DELETED","params"=>array());
                    $this->setInfo(array("msg"=>$result));
                }else{
                    if( $this->config['debug'] ) $this->_log('$fullpath.$namefile - '.$fullpath.$namefile);
                    $result = array("query"=>"BE_DELETE_NOT_EXIED","params"=>array());
                    $this->setInfo(array("msg"=>$result, "status"=> 0));
                }
            }else{
                if( $this->config['debug'] ) $this->_log('$fullpath.$namefile - '.$fullpath.$namefile);
                $result = array("query"=>"BE_DELETE_NOT_EXIED","params"=>array());
                $this->setInfo(array("msg"=>$result, "status"=> 0));
            }
        }elseif(is_array($namefiles)){
            if(count($namefiles)>0){
                $fullpath = $this->getFullPath().$path;
                $data = array();
                foreach ($namefiles as $key => $namefile) {
                    $file = new Filesystem;
                    if($this->validNameFile($namefile,false) && $file->exists($fullpath.$namefile)){
                        if( $this->config['debug'] ) $this->_log('$fullpath.$namefile - '.$fullpath.$namefile);
                        if(is_dir($fullpath.$namefile)){
                            $file->remove($fullpath.$namefile);
                            $file->remove($this->getFullPath().'/'.$this->config['folder_thumb'].$path.$namefile);
                            $data[] = array("status"=>1,"namefile"=>$namefile,"query"=>"BE_DELETE_DELETED","params"=>array());
                        }elseif($this->validNameFile($namefile) && is_file($fullpath.$namefile)){
                            $file2 = new \SplFileInfo($fullpath.$namefile);
                            $filename = $file2->getFilename();
                            foreach ($this->config['images']['resize'] as $key => $value) {
                                $image_info = $this->imageSizeName($path,$filename,$value);
                                $filename_new = $image_info['name'];
                                $fullpaththumb_name = $this->getFullPath().'/'.$this->config['folder_thumb'].$path.$filename_new;
                                $file->remove($fullpaththumb_name);
                            }
                            $file->remove($fullpath.$namefile);
                            $data[] = array("status"=>1,"namefile"=>$namefile,"query"=>"BE_DELETE_DELETED","params"=>array());
                        }else{
                            $data[] = array("status"=>0,"namefile"=>$namefile,"query"=>"BE_DELETE_NOT_EXIED","params"=>array());
                        }
                    }else{
                        $data[] = array("status"=>0,"namefile"=>$namefile,"query"=>"BE_DELETE_NOT_EXIED","params"=>array());
                    }
                }
                $this->setInfo(array("data"=>$data));
            }else{
                $result = array("query"=>"BE_DELETE_NOT_EXIED","params"=>array());
                $this->setInfo(array("msg"=>$result, "status"=> 0));
            }
        }
    }
821867
public function removeLoaderByFile($file)
    {
        foreach ($this->loaders as $i => $loader) {
            /** @var LoaderInterface $loader */
            if ($loader->supports($file)) {
                unset($this->loaders[$i]);
            }
        }
    }
620099
protected function deleteFile($file, $dir) {
        if ($file != "." && $file != "..") {
            if (is_dir($dir."/".$file)) {
                $this->flushDir($dir."/".$file);
                rmdir($dir."/".$file);
            } else {
                unlink($dir."/".$file);
            }
        }
    }
927400
private function removePath(string $path): void
    {
        if (false !== strpos($path, '*')) {
            $paths = glob($path);
            foreach ($paths as $path) {
                $this->removePath($path);
            }
        } else {
            if (is_dir($path)) {
                $iterator = new \RecursiveDirectoryIterator($path);
                $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
                /** @var \SplFileInfo $file */
                foreach ($iterator as $file) {
                    if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                        continue;
                    }
                    if ($file->isLink() || $file->isFile()) {
                        unlink($file->getPathname());
                    } else {
                        rmdir($file->getPathname());
                    }
                }
                rmdir($path);
            } else {
                if (is_file($path)) {
                    unlink($path);
                }
            }
        }
    }
612236
public function delete()
    {
        try {
            $this->getClient()->delete($this->getUrl());
        } catch (ClientException $e) {
            $statusCode = $e->getResponse()->getStatusCode();

            if (HttpResponse::HTTP_NOT_FOUND === $statusCode || HttpResponse::HTTP_GONE === $statusCode) {
                throw new FileException('File not found.');
            }
        }
    }
221545
public function delFile($file)
    {
        $file = $this->checkpath($file);
        if (@!ftp_delete($this->linkid, $file)) {
            $this->close();
            return false;
        }
        $this->close();
        return true;
    }
911122
protected function _deleteFile($filename) {
        $ini = Zend_Registry::get('config');
        $uploadPath = $ini->app->uploadsDirectory;
        $uploadPath = rtrim($uploadPath, '/\\').DIRECTORY_SEPARATOR;
        $filePath   = $uploadPath.$filename;
        if (file_exists($filePath) && is_file($filePath)) {
            unlink($filePath);
        }
    }
819860
public function purgeFile($filename)
    {
        if (isset($this->_fileHandlers[$filename])) {
            $this->_fileHandlers[$filename]->close();
        }
        unset($this->_fileHandlers[$filename]);
    }
713926
public function delete( $file )
	{
		// check for absolut path
		if ( substr( $file, 0, 1 ) == '/' ) 
		{
			return CCFile::delete( $file );
		}
		
		return CCFile::delete( $this->path( $file ) );
	}
966880
function delete_file($filepath)
	{
		if ( ! $this->_is_conn())
		{
			return false;
		}

		$result = @ftp_delete($this->_conn_id, $filepath);

		if ($result === false)
		{
			if ($this->_debug == true)
			{
				throw new \FtpFileAccessException('Unable to delete');
			}
			return false;
		}

		return true;
	}