Package com.github.oeuvres.alix.util
Class Dir
java.lang.Object
com.github.oeuvres.alix.util.Dir
Static tools to deal with directories (and files). Kept in java 7.
-
Method Summary
Modifier and TypeMethodDescriptionDelete files from a list by glob.static StringResolve relative links for glob.Add files to a list with a glob.List files by glob.static booleanDelete a folder by File object (maybe a bit slow for lots of big folders).static booleanDelete a folder by path (use java.nio stream, should be faster thenrm(File))
-
Method Details
-
globNorm
Resolve relative links for glob.- Parameters:
glob- requested path as a glob.base- file from which resolve relative links.- Returns:
- an absolute glob.
- Throws:
IOException- file exceptions.
-
include
Add files to a list with a glob.- Parameters:
paths- list of paths to populate.glob- pattern of file to append.- Returns:
- the list of paths completed.
- Throws:
IOException- file errors.
-
exclude
Delete files from a list by glob.- Parameters:
paths- list of files.glob- pattern to select files.- Returns:
- list of selected paths.
- Throws:
IOException- file errors.
-
ls
List files by glob.- Parameters:
glob- pattern to select files.- Returns:
- list of selected paths.
- Throws:
IOException- file errors.
-
rm
Delete a folder by path (use java.nio stream, should be faster thenrm(File))- Parameters:
path- file to delete.- Returns:
- true if exists and deleted, false otherwise.
- Throws:
IOException- file error.
-
rm
Delete a folder by File object (maybe a bit slow for lots of big folders).- Parameters:
file- folder to delete.- Returns:
- true if exists and deleted, false otherwise.
-