public class FileFinder extends Object
*.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.
Modifier and Type | Class and Description |
---|---|
private static class |
FileFinder.Finder
Internal class used by the
findFiles(...) methods to actually
"walk" the directory tree. |
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
logger
Logging object.
|
Constructor and Description |
---|
FileFinder() |
Modifier and Type | Method and 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").
|
private static final org.slf4j.Logger logger
public FileFinder()
public static List<String> findFiles(String path, String globPattern)
Note: "glob" patterns are simple DOS/UNIX style. Think "*.py".
path
- Directory to search.globPattern
- Pattern to match against.List
of String
versions of matching paths. The
list will be empty (Collections.emptyList()
if there were no
matches.public static List<String> findFiles(String path, String globPattern, int depth)
Note: "glob" patterns are simple DOS/UNIX style. Think "*.py".
path
- Directory to search.globPattern
- Pattern to match against.depth
- Maximum number of directory levels to visit.List
of String
versions of matching paths. The
list will be empty (Collections.emptyList()
if there were no
matches.