Class FileJanitor


  • public class FileJanitor
    extends java.lang.Object
    class to clean up files and directories the directories are retained longer since java knows only last modified. This is actually a good thing
    • Constructor Summary

      Constructors 
      Constructor Description
      FileJanitor​(java.io.File baseDir, long age)  
      FileJanitor​(java.io.File baseDir, java.io.FileFilter filter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Vector<java.io.File> cleanup()
      process all accepted files and empty directories that have been accepted
      note that the filter may actually do something
      boolean isRecurseDirs()  
      void setDeleteEmptyDir​(boolean delEmpty)
      if true, we delete empty directories
      void setLogSingle​(boolean logSingle)
      if true, we log each deletion
      void setMinKeep​(int minKeep)  
      void setRecurseDirs​(boolean recurseDirs)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FileJanitor

        public FileJanitor​(java.io.File baseDir,
                           java.io.FileFilter filter)
        Parameters:
        baseDir -
        filter - the file filter that
      • FileJanitor

        public FileJanitor​(java.io.File baseDir,
                           long age)
        Parameters:
        baseDir -
        age - the minimum zapp file age in seconds
    • Method Detail

      • setMinKeep

        public void setMinKeep​(int minKeep)
      • setLogSingle

        public void setLogSingle​(boolean logSingle)
        if true, we log each deletion
        Parameters:
        logSingle -
      • setDeleteEmptyDir

        public void setDeleteEmptyDir​(boolean delEmpty)
        if true, we delete empty directories
        Parameters:
        delEmpty -
      • isRecurseDirs

        public boolean isRecurseDirs()
      • setRecurseDirs

        public void setRecurseDirs​(boolean recurseDirs)
      • cleanup

        public java.util.Vector<java.io.File> cleanup()
        process all accepted files and empty directories that have been accepted
        note that the filter may actually do something
        Returns:
        the list of files that have been processed
        note these no longer exist in case of a kill filter
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object