Deletes files recursively and remains quiet even if an exception is thrown.
@param files the files to delete
775819
public static void deleteFilesRecursivelyAndQuietly( File... files ) {

		try {
			deleteFilesRecursively( files );

		} catch( IOException e ) {
			Logger logger = Logger.getLogger( Utils.class.getName());
			logException( logger, e );
		}
	}
384208
private static void delete(File file) {
    if (file.isDirectory()) {
      File[] files = file.listFiles();
      if (files != null) {
        for (File child : files) {
          delete(child);
        }
      }
    }

    file.delete();
  }
478327
public static void delete(final File file, final boolean ignoreFailures)
    {
        if (file.isDirectory())
        {
            final File[] files = file.listFiles();
            if (null != files)
            {
                for (final File f : files)
                {
                    delete(f, ignoreFailures);
                }
            }
        }

        if (!file.delete() && !ignoreFailures)
        {
            try
            {
                Files.delete(file.toPath());
            }
            catch (final IOException ex)
            {
                LangUtil.rethrowUnchecked(ex);
            }
        }
    }
589639
public static void deleteAllFiles(final File file) throws IOException
	{
		String error = null;
		if (!file.exists())
		{
			return;
		}
		final Exception ex = checkFile(file);
		if (ex != null)
		{
			try
			{
				throw ex;
			}
			catch (final Exception e)
			{
				e.printStackTrace();
			}
		}
		DeleteFileExtensions.deleteFiles(file);
		if (!file.delete())
		{
			error = "Cannot delete the File " + file.getAbsolutePath() + ".";

			throw new IOException(error);

		}
	}
867367
private void doDelete(java.io.File file)
    {
        // Make the directory to write the objects to.
        if (file.isDirectory()) {

            // Find all of the files in the next level.

            // JCLRM does not have listFiles...
            // java.io.File nextFiles[] = file.listFiles();

            String[] files = file.list();
            java.io.File[] nextFiles = null;
            if (files != null) {
                nextFiles = new java.io.File[files.length];
                for (int iFile = 0; iFile < nextFiles.length; iFile++) {
                    nextFiles[iFile] = new java.io.File(file.getPath(),
                                                        files[iFile]);
                }
            }

            if (nextFiles != null) {
                for (int iFile = 0; // Index to next files.
                iFile < nextFiles.length; iFile++) {
                    java.io.File nextFile = nextFiles[iFile];
                    if (nextFile.isDirectory()) {
                        doDelete(nextFile);
                    } else {
                        nextFile.delete();
                    }
                } // for loop over existing Files.
            }
        } // if (file.isDirectory()).
        file.delete();
    }
798094
public static boolean delFileOrFolder(File file) {
        if (file == null || !file.exists()) {
            // do nothing
        } else if (file.isFile()) {
            file.delete();
        } else if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File sonFile : files) {
                    delFileOrFolder(sonFile);
                }
            }
            file.delete();
        }
        return true;
    }
1104548
public static void deleteContentsRecursive(@Nonnull File file) throws IOException {
        deleteContentsRecursive(fileToPath(file), PathRemover.PathChecker.ALLOW_ALL);
    }
52874
public static void deletePath(FileSystem fs, Path f, boolean recursive) throws IOException {
    if (fs.exists(f) && !fs.delete(f, recursive)) {
      throw new IOException("Failed to delete: " + f);
    }
  }
601285
public static boolean deleteAllIfExists(final File file) {
        if ((file == null) || !file.exists()) {
            return false;
        }

        if (file.isDirectory()) {
            final File[] files = file.listFiles();

            if (N.notNullOrEmpty(files)) {
                for (File subFile : files) {
                    if (subFile == null) {
                        continue;
                    }

                    if (subFile.isFile()) {
                        if (subFile.delete() == false) {
                            return false;
                        }
                    } else {
                        if (deleteAllIfExists(subFile) == false) {
                            return false;
                        }
                    }
                }
            }
        }

        return file.delete();
    }
905434
private static void recursiveDelete(File f) throws IOException
   {
      if (f != null && f.exists())
      {
         File[] files = f.listFiles();
         if (files != null)
         {
            for (int i = 0; i < files.length; i++)
            {
               if (files[i].isDirectory())
               {
                  recursiveDelete(files[i]);
               }
               else
               {
                  if (!files[i].delete())
                     throw new IOException("Could not delete " + files[i]);
               }
            }
         }
         if (!f.delete())
            throw new IOException("Could not delete " + f);
      }
   }
163565
static void cleanup() {
        LOGGER.entering();

        for (String temp : files) {
            new File(temp).delete();
        }

        // Cleaning up the files list
        files.clear();
        LOGGER.exiting();
    }
1327872
public void setDeleteFiles(java.util.Collection<DeleteFileEntry> deleteFiles) {
        if (deleteFiles == null) {
            this.deleteFiles = null;
            return;
        }

        this.deleteFiles = new java.util.ArrayList<DeleteFileEntry>(deleteFiles);
    }
636183
private void deleteRecursive(final File file) {
        if (file.isDirectory()) {
            final String[] files = file.list();
            if (files != null) {
                for (String name : files) {
                    deleteRecursive(new File(file, name));
                }
            }
        }

        if (!file.delete()) {
            ControllerLogger.ROOT_LOGGER.cannotDeleteFileOrDirectory(file);
        }
    }
1181418
protected void deleteEntryFiles() throws IOException {
    File[] files = getDirectory().listFiles();
    if(files == null) return;
    
    String prefix = getEntryLogPrefix();
    String suffix = getEntryLogSuffix();
    
    for (File file : files) {
      String fileName = file.getName();
      if (fileName.startsWith(prefix) && fileName.endsWith(suffix)) {
        if (file.delete()) {
          _log.info("file " + file.getAbsolutePath() + " deleted");
        } else {
          _log.warn("file " + file.getAbsolutePath() + " not deleted");
        }
      }
    }
  }
591174
public static boolean deleteRecursive(final File file) {
		boolean result = true;
		if (file.isDirectory()) {
			for (final File inner : file.listFiles()) {
				result &= deleteRecursive(inner);
			}
		}
		return result & file.delete();
	}
510622
public void setFiles(final List<File> files) {
        if (files == null && this.files == null) {
            return;
        } else if (files == null) {
            removeChild(this.files);
            this.files = null;
        } else if (this.files == null) {
            this.files = new FileList(CommonConstants.CS_FILE_TITLE, files);
            appendChild(this.files, false);
        } else {
            this.files.setValue(files);
        }
    }
147963
private void cleanLogFilesIfNecessary() {
    File logDir = new File(folderPath);
    File[] files = logDir.listFiles();
    if (files == null) {
      return;
    }
    for (File file : files) {
      if (cleanStrategy.shouldClean(file)) {
          file.delete();
      }
    }
  }