/* * [AllButFootDirectoriesFilter.java] * * Summary: FileFilter that accepts all directories, except /foot/ but not files. * * Copyright: (c) 2014-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2014-04-07 initial version. */ package com.mindprod.filter; import java.io.File; import java.io.FilenameFilter; /** * FileFilter that accepts all directories, except /foot/ but not files. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2014-04-07 initial version * @since 2014-04-07 */ public final class AllButFootDirectoriesFilter implements FilenameFilter { /** * true if debugging. Enables debugging harness. */ private static final boolean DEBUGGING = false; /** * constructor */ public AllButFootDirectoriesFilter() { } /** * Select only files with that pass muster * * @param dir the directory in which the file was found. * @param name the name of the file * * @return true if and only if the name should be included in the file list; false otherwise. */ public boolean accept( File dir, String name ) { final File f = new File( dir, name ); // the dir we are testing is dir.name not dir. return f.isDirectory() && !name.equalsIgnoreCase( "foot" ); } }