Package org.apache.commons.io.filefilter

Examples of org.apache.commons.io.filefilter.AgeFileFilter


        int countToPurge = files.length - retentionCount;

        if ( daysOlder > 0 )
        {
            long cutoff = System.currentTimeMillis() - ( 24 * 60 * 26 * 1000 * daysOlder );
            filter.addFileFilter( new AgeFileFilter( cutoff ) );
        }

        files = directory.listFiles( (FileFilter) filter );

        if ( files == null )
View Full Code Here


    File directory = new File(path);
    File[] subdirs = directory.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
    for (File dir : subdirs)
    {
      result = result + deleteFiles(dir, new AgeFileFilter(cutoffDate));
    }

    return result;
  }
View Full Code Here

  void clean() {
    long cutoff = System.currentTimeMillis() - ONE_DAY_IN_MILLISECONDS;
    Collection<File> files = FileUtils.listFiles(tempDir, new AndFileFilter(
        new PrefixFileFilter("sonar-runner-batch"),
        new AgeFileFilter(cutoff)
    ), null);

    for (File file : files) {
      FileUtils.deleteQuietly(file);
    }
View Full Code Here

                    //set expire time to delete all files older than 48 hrs
                    Calendar expireTime = Calendar.getInstance();
                    expireTime.add(Calendar.HOUR, - 48);

                    Iterator<File> filesToDelete = FileUtils.iterateFiles(delDir, new AgeFileFilter(expireTime.getTime()), TrueFileFilter.TRUE);
                    while(filesToDelete.hasNext()) {
                        delFile=filesToDelete.next();
                        delFile.delete();
                    }
View Full Code Here

  }

  @Override
  public void deleteBefore(DateTime deleteBefore) throws IOException {
    log.debug("Deleting log files older than " + deleteBefore + " from " + baseLogFolder);
    File[] filesToDelete = baseLogFolder.listFiles((FileFilter) new AndFileFilter(logFileFilter, new AgeFileFilter(
        deleteBefore.toDate())));
    for (File fileToDelete : filesToDelete) {
      if (log.isDebugEnabled()) {
        log.debug("Deleting " + fileToDelete);
      }
View Full Code Here

        if ( !required )
        {
            Collection<File> files =
                org.apache.commons.io.FileUtils.listFiles( new File( project.getBuild().getSourceDirectory() ),
                                                           new AgeFileFilter( lastCompiledArtifact, false ),
                                                           TrueFileFilter.INSTANCE );

            // If has any newer file
            if ( files.size() > 0 )
            {
View Full Code Here

            }
        }
    }
    public static void deleteNewFiles(File root,long threadhold)
    {
        String[] files = root.list( new AgeFileFilter(threadhold,false));
        for(String s:files)
        {
            try
            {
                //System.out.println(s);
View Full Code Here

            }
        }
    }
    public static void getNewFiles(File root,long threadhold)
    {
        String[] files = root.list( new AgeFileFilter(threadhold,false));
        for(String s:files)
        {
            System.out.println(s);
        }
    }
View Full Code Here

        private void deleteDir()
        {
            long cutoff = System.currentTimeMillis() - (minutes * 60 * 1000);
            try
            {
                String[] files = job_dir.list(new AgeFileFilter(cutoff));
                for (String fs : files)
                {
                    File fd = new File(job_dir, fs);
                    String[] il = fd.list();
                    if (il.length == 0)//empty dir
View Full Code Here

TOP

Related Classes of org.apache.commons.io.filefilter.AgeFileFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.