Class FileUtil

java.lang.Object
de.arstwo.twotil.FileUtil

public class FileUtil extends Object
Various file-related utility functions.
  • Method Details

    • fileOlderThan

      public static Predicate<Path> fileOlderThan(long amountToSubtract, TemporalUnit unit)
      Creates a predicate for a functional context to test if a file is older than a given time frame.
    • unzipRootOnly

      public static boolean unzipRootOnly(Path source, Path targetDir)
      Extracts the content of a zip file to a given target directory.

      Ignores directories in the zip, only files in the root directory are extracted.

    • tryDeletePath

      public static boolean tryDeletePath(Path p)
      Tries to delete a given path, catches potential IOExceptions, and returns true on success, false otherwise.