Delete the file associated with a session

@param filename name of the file containing the session's information
@return true if file was deleted, false otherwise
@throws Exception if the file associated with the session fails to be deleted
167847
private boolean deleteFile(String filename) throws Exception {
        if (filename == null) {
            return false;
        }
        File file = new File(storeDir, filename);
        return Files.deleteIfExists(file.toPath());
    }
1226505
public static function clear($filename)
    {
        $filename = static::path($filename);

        if (!file_exists($filename)) {
            return;
        }

        if (!unlink($filename)) {
            throw new \Exception("Unable to delete file (" . $filename . ")");
        }
    }
769476
private synchronized static void delete(File file) {
        // Check if file is directory
        if (file.isDirectory()) {
            // Get all files in the folder
            File[] files = file.listFiles();

            // Delete each file in the folder
            for (int i = 0; i < files.length; ++i) {
                delete(files[i]);
            }

            // Delete the folder
            file.delete();
        } else {
            // Delete the file if it is not a folder
            file.delete();
        }
    }
1090967
@Override
	public void deleteSession(String sessionName) {
		logger.debug("deleteSession " + sessionName);
	    if (databaseServer == null) {
	    	return;
	    }
        databaseServer = null;
    }
1372986
public synchronized void delete() {
		try {
			clear();
		} catch (Exception ign) {
		}
		try {
			close();
		} catch (Exception ign) {
		}
		try {
			fileRedo.delete();
		} catch (Exception ign) {
		}
		try {
			fileStorage.delete();
		} catch (Exception ign) {
		}
		try {
			fileFreeBlocks.delete();
		} catch (Exception ign) {
		}
	}
68094
@Override
  public void delete() {
    LOGGER.debug("Deleting {}", this);
    Path path = file.file().toPath();
    if (Files.exists(path)) {
      try {
        Files.delete(file.file().toPath());
      } catch (IOException e) {
      }
    }
  }
591295
public void delete() {
    try {
      getDFS().delete(this.path, true);

    } catch (IOException e) {
      e.printStackTrace();
      MessageDialog.openWarning(null, "Delete file",
          "Unable to delete file \"" + this.path + "\"\n" + e);
    }
  }
1269312
public void delete() throws IOException {
        String idKey = idStrategy().keyFor(id);
        File existingUserFolder = getExistingUserFolder();
        UserIdMapper.getInstance().remove(id);
        AllUsers.remove(id);
        deleteExistingUserFolder(existingUserFolder);
        UserDetailsCache.get().invalidate(idKey);
    }
1299819
public static boolean delete(File file)
    {
        if (!file.exists())
            return false;
        if (file.isDirectory())
        {
            File[] files = file.listFiles();
            for (int i=0;files!=null && i<files.length;i++)
                delete(files[i]);
        }
        return file.delete();
    }
    
    
    /* ------------------------------------------------------------ */
    /** Run copy for copyThread()
     */
    public void handle(Object o)
    {
        Job job=(Job)o;
        try {
            if (job.in!=null)
                copy(job.in,job.out,-1);
            else
                copy(job.read,job.write,-1);
        }
        catch(IOException e)
        {
            LogSupport.ignore(log,e);
            try{
                if (job.out!=null)
                    job.out.close();
                if (job.write!=null)
                    job.write.close();
            }
            catch(IOException e2)
            {
                LogSupport.ignore(log,e2);
            }
        }
    }

    /* ------------------------------------------------------------ */
    /** 
     * @return An outputstream to nowhere
     */
    public static OutputStream getNullStream()
    {
        return __nullStream;
    }

    /**
     * closes an input stream, and logs exceptions
     *
     * @param is the input stream to close
     */
    public static void close(InputStream is)
    {
        try
        {
            if (is != null)
                is.close();
        }
        catch (IOException e)
        {
            LogSupport.ignore(log,e);
        }
    }

    /**
     * closes an output stream, and logs exceptions
     *
     * @param os the output stream to close
     */
    public static void close(OutputStream os)
    {
        try
        {
            if (os != null)
                os.close();
        }
        catch (IOException e)
        {
            LogSupport.ignore(log,e);
        }
    }

    
    /* ------------------------------------------------------------ */
    /* ------------------------------------------------------------ */
    private static class NullOS extends OutputStream                                    
    {
        public void close(){}
        public void flush(){}
        public void write(byte[]b){}
        public void write(byte[]b,int i,int l){}
        public void write(int b){}
    }
    private static NullOS __nullStream = new NullOS();
    
    /* ------------------------------------------------------------ */
    /** 
     * @return An writer to nowhere
     */
    public static Writer getNullWriter()
    {
        return __nullWriter;
    }
    
    /* ------------------------------------------------------------ */
    /* ------------------------------------------------------------ */
    private static class NullWrite extends Writer                                    
    {
        public void close(){}
        public void flush(){}
        public void write(char[]b){}
        public void write(char[]b,int o,int l){}
        public void write(int b){}
        public void write(String s){}
        public void write(String s,int o,int l){}
    }
    private static NullWrite __nullWriter = new NullWrite();
}
22857
public function removeFile( $fileName )
	{
		if( !$this->numFiles )
			return FALSE;
		foreach( $this->files as $key => $information )
		{
			if( $information['name'] !== $fileName )
				continue;
			$this->numFiles--;
			unset( $this->files[$key] );
			return TRUE;
		}
	}
305507
private boolean delete(final File f) throws IOException {

		if (f.isDirectory()) {

			final File[] files = f.listFiles();
			for (int i = 0; i < files.length; i++) {
				final boolean del = delete(files[i]);
				if (del == false) {
					return false;
				}
			}

		} else {
			return f.delete();
		}

		// Now directory is empty
		return f.delete();
	}
361735
@Override
    public void delete(final String fileName) throws FileMissingException, IOException {

        // This prevents other read/write/delete/merge/purge operations to occur
        this.lock.writeLock().lock();

        try {
            // Check active flag
            Preconditions.checkState(this.active.get());

            // Lookup the zip file / deleted status for the supplied file
            final String zipName = indexGet(fileName);

            // Proceed only if file is not marked as deleted
            if (!DELETED.equals(zipName)) {
                if (zipName != null) {

                    // Explode the ZIP file (except for the deleted file)
                    final Map<String, String> entries = new HashMap<>();
                    final Path zipPath = pathForZipFile(zipName);
                    LOGGER.debug("Exploding zip file {}", zipPath);
                    try (final ZipInputStream zipStream = new ZipInputStream(openForRead(zipPath))) {
                        ZipEntry entry;
                        while ((entry = zipStream.getNextEntry()) != null) {
                            final String smallName = entry.getName();
                            if (!smallName.equals(fileName)) {
                                entries.put(smallName, null);
                                final Path smallPath = pathForSmallFile(smallName);
                                // note: small file may already exist (as previously packed in ZIP
                                // file but not yet purged): in this case it is silently
                                // overwritten
                                try (OutputStream stream = openForWrite(smallPath)) {
                                    ByteStreams.copy(zipStream, stream);
                                }
                            }
                        }
                    } catch (final IOException ex) {
                        // Perform clean up and propagate exception
                        for (final String smallName : entries.keySet()) {
                            final Path smallPath = pathForSmallFile(smallName);
                            try {
                                this.fileSystem.delete(smallPath, false);
                            } catch (final Throwable ex2) {
                                LOGGER.warn("Could not delete extracted file " + smallPath
                                        + " after failed to explod ZIP file " + zipPath, ex2);
                            }
                        }
                        throw new IOException("Cannot explode ZIP file " + zipPath, ex);
                    }

                    // Update index, marking small file and ZIP as deleted and de-associating
                    // other small files previously in the ZIP from the ZIP file
                    entries.put(fileName, DELETED); // because the file may still exist
                    entries.put(zipName, DELETED);
                    indexPut(entries);
                    return;

                } else {
                    // Mark a small file with the name supplied as deleted
                    final Path smallPath = pathForSmallFile(fileName);
                    if (this.fileSystem.exists(smallPath)) {
                        LOGGER.debug("Marking small file {} as deleted", smallPath);
                        indexPut(ImmutableMap.of(fileName, DELETED));
                        return;
                    }
                }
            }

            // Report file does not exist
            throw new FileMissingException(fileName, "The file does not exist");

        } finally {
            // Always release the lock
            this.lock.writeLock().unlock();
        }
    }
853445
public function deleteFile($fileName) {
        $files = $this->getFiles();
        $success = false;
        foreach ($files as $file) {
            if($file->getRelativePathname() === $fileName){
                if(!$file->isWritable()){
                    throw new RuntimeException(sprintf("The file '%s' is not writable and can not be deleted.",$fileName));
                }
                unlink($file->getRealPath());
                if($file->isReadable()){
                    throw new RuntimeException(sprintf("The file '%s' could not be deleted",$fileName));
                }
                $success = true;
            }
        }
        return $success;
    }
409540
protected void removeFile(String subdir, String filename) throws IOException {
        Path dir = root;
        if (subdir != null) {
            dir = dir.resolve(subdir);
        }
        Files.deleteIfExists(dir.resolve(filename));
    }
26633
public void delete() throws IOException {
		File f = tempFile;
		if(f!=null) {
			FileUtils.delete(f);
			tempFile = null;
		}
	}
728055
public boolean processClassFile(String fileName) {
        Path path = Paths.get(fileName);
        try {
            ClassFile cf = ClassFile.read(path);
            processClass(cf);
            return true;
        } catch (NoSuchFileException nsfe) {
            errorNoFile(fileName);
        } catch (IOException | ConstantPoolException ex) {
            errorException(ex);
        }
        return false;
    }
3249
private void checkForExistence(String fileName) throws IOException {
        File file = new File(fileName);
        if (!file.exists()) {
            throw new FileNotFoundException("File with name " + fileName + " does not exist.");
        }
        if (!file.isFile()) {
            throw new IOException("Provided string does not correspond to an actual file.");
        }

    }