public final class FileSearchUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsFile(File parent,
File search)
Checks if the given file contains only in the parent file, not in the subdirectories.
|
static boolean |
containsFile(File fileToSearch,
String pathname)
Checks if the given file contains in the parent file.
|
static boolean |
containsFileRecursive(File parent,
File search)
Checks if the given file contains only in the parent file recursively.
|
static long |
countAllFilesInDirectory(File dir,
long length,
boolean includeDirectories)
Counts all the files in a directory recursively.
|
static List<File> |
findAllFiles(File dir,
String fileSearchPattern)
Finds all files that match the search pattern.
|
static List<File> |
findFiles(File dir,
String filenameToSearch)
Finds all files that match the search pattern.
|
static List<File> |
findFiles(String start,
String[] extensions)
Searches for files with the given extensions and adds them to a Vector.
|
static List<File> |
findFilesRecursive(File dir,
String filenameToSearch)
Finds all files that match the search pattern.
|
static List<File> |
findFilesWithFilter(File dir,
String... extension)
Finds all files that match the given extension.
|
static List<File> |
getAllFilesFromDir(File dir)
Gets the all files from directory.
|
static List<File> |
getAllFilesFromDirRecursive(File dir)
Gets all the files from directory recursive.
|
static long |
getFileLengthInKilobytes(File dir)
Gets the file length from the given file in Kilobytes.
|
static long |
getFileLengthInMegabytes(File dir)
Gets the file length from the given file in Megabytes.
|
static String |
getSearchFilePattern(String... fileExtensions)
Gets a regex search file pattern that can be used for searching files with a Matcher.
|
static List<File> |
listDirs(File dir)
List the directories from the given file(directory).
|
static boolean |
match(String stringToMatch,
String[] suffixes)
Checks the given String matches the given suffixes.
|
public static boolean containsFile(File parent, File search)
parent - The parent directory to search.search - The file to search.public static boolean containsFile(File fileToSearch, String pathname)
fileToSearch - The parent directory to search.pathname - The file to search.public static boolean containsFileRecursive(File parent, File search)
parent - The parent directory to search.search - The file to search.public static long countAllFilesInDirectory(File dir, long length, boolean includeDirectories)
dir - the directory.length - the current length. By start is this 0.includeDirectories - If this is true then the directories are in the count too.public static List<File> findAllFiles(File dir, String fileSearchPattern)
dir - The directory to search.fileSearchPattern - The regex file search pattern.public static List<File> findFiles(File dir, String filenameToSearch)
dir - The directory to search.filenameToSearch - The search pattern. Allowed wildcards are "*" and "?".public static List<File> findFiles(String start, String[] extensions)
start - The path to the file.extensions - The extensions to find.public static List<File> findFilesRecursive(File dir, String filenameToSearch)
dir - The directory to search.filenameToSearch - The search pattern. Allowed wildcards are "*" and "?".public static List<File> findFilesWithFilter(File dir, String... extension)
dir - The directory to search.extension - The extensions to search.public static List<File> getAllFilesFromDir(File dir)
dir - the dirpublic static List<File> getAllFilesFromDirRecursive(File dir)
dir - the directorypublic static long getFileLengthInKilobytes(File dir)
dir - the dirpublic static long getFileLengthInMegabytes(File dir)
dir - the directorypublic static String getSearchFilePattern(String... fileExtensions)
fileExtensions - The file extensions that shell exist in the search pattern.public static List<File> listDirs(File dir)
dir - the directory.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.