Class FileFinder

java.lang.Object
edu.wisc.ssec.mcidasv.util.FileFinder

public class FileFinder extends Object
Allows for easy searching of files matching "glob" patterns (e.g. *.py) in a given directories and its subdirectories.

Note: the findFiles(...) methods will block until the search finishes! If this is a concern, for the time being, please consider using findFiles(String, String, int) with a reasonable depth value.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    Internal class used by the findFiles(...) methods to actually "walk" the directory tree.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
    Logging object.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<String>
    findFiles(String path, String globPattern)
    Find files matching the specified "glob" pattern in the given directory (and all of its subdirectories).
    static List<String>
    findFiles(String path, String globPattern, int depth)
    Find files matching the specified "glob" pattern in the given directory (and not exceeding the given "depth").

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
      Logging object.
  • Constructor Details

  • Method Details

    • findFiles

      public static List<String> findFiles(String path, String globPattern)
      Find files matching the specified "glob" pattern in the given directory (and all of its subdirectories).

      Note: "glob" patterns are simple DOS/UNIX style. Think "*.py".

      Parameters:
      path - Directory to search.
      globPattern - Pattern to match against.
      Returns:
      List of String versions of matching paths. The list will be empty (Collections.emptyList() if there were no matches.
    • findFiles

      public static List<String> findFiles(String path, String globPattern, int depth)
      Find files matching the specified "glob" pattern in the given directory (and not exceeding the given "depth").

      Note: "glob" patterns are simple DOS/UNIX style. Think "*.py".

      Parameters:
      path - Directory to search.
      globPattern - Pattern to match against.
      depth - Maximum number of directory levels to visit.
      Returns:
      List of String versions of matching paths. The list will be empty (Collections.emptyList() if there were no matches.