Locate Files
AsciidoctorJ offers a collection of utilities called DirectoryWalkers
for scenarios where sources may be organized in special ways.
Class | Type | Description |
---|---|---|
|
Concrete class |
Locates all files of given folder and all its subfolders. Ignores files starting with underscore (_). |
|
Concrete class |
Locates all files of given folder following a glob expression. |
You can also create your own DirectoryWalkers by extending AbstractDirectoryWalker class or DirectoryWalker interface.
|
AsciiDocDirectoryWalker class
A utility class AsciiDocDirectoryWalker
is available for searching the AsciiDoc files present in a root folder and its subfolders.
AsciiDocDirectoryWalker
locates all files that end with .adoc
, .ad
, .asciidoc
or .asc
.
Also it ignores all files starting with underscore (_
).
AsciiDocDirectoryWalker
import java.util.List;
import org.asciidoctor.AsciiDocDirectoryWalker;
DirectoryWalker directoryWalker = new AsciiDocDirectoryWalker("docs"); (1)
List<File> asciidocFiles = directoryWalker.scan(); (2)
1 | Defines which parent directory is used for searching. |
2 | Returns a list of all AsciiDoc files found in root folder and its subfolders. |
GlobDirectoryWalker class
A utility class GlobDirectoryWalker
is available for searching the AsciiDoc files present in a root folder and scanning using a Glob
expression.
GlobDirectoryWalker
locates all files that end with .adoc
, .ad
, .asciidoc
or .asc
.
GlobDirectoryWalker
import java.util.List;
import org.asciidoctor.GlobDirectoryWalker;
DirectoryWalker directoryWalker = new GlobDirectoryWalker("docs", "**/*.adoc"); (1)
List<File> asciidocFiles = directoryWalker.scan(); (2)
1 | Defines which parent directory is used for searching and the glob expression. |
2 | Returns a list of all AsciiDoc files matching given glob expression. |