-i (include) and -e (exclude) take glob patterns. Enclose each
pattern in double quotes, so the shell does not expand it:
auditor hash input_path -i "**/*.txt"
Patterns are matched against the path of each file relative to
input_path, with / as separator (also on Windows). For
input_path/src/app.json that is src/app.json. The folders
above input_path never take part: **/test/** selects the
files of a test folder inside input_path, even if
input_path itself is inside a folder named test.
-i keeps only the files that match; -e leaves out the files
that match. Both accept several patterns (-i "*.doc" "*.xls"), and can be
used together: -e is applied to what -i selected.
check applies the same patterns to the files listed in the
<Audit_FullList>.
Below, the rules to write glob patterns (every example is verified by auditor's tests):
/)
*.doc - All .doc files directly in input_path (not in its subfolders)test_*.txt - Files starting with "test_" and ending
with ".txt"
file.* - Any file named "file" with any extension
file?.txt - Matches file1.txt,
fileA.txt, but not file10.txt
test?.ts - Matches test1.ts,
testX.ts
**/*.txt - All txt files, at any depth (input_path itself included)src/**/*.json - All JSON files under src/ at any depth
**/test/** - Any file in a "test" directory at any
level
file[123].txt - Matches file1.txt,
file2.txt, file3.txt
[abc]*.txt - txt files starting with a, b, or ctest[0-9].log - test0.log through test9.log[!.]*.txt - Text files directly in input_path not starting with a dotfile[!0-9].rs - file followed by non-digit*.{doc,xls} - All doc and xls files{src,tests}/**/*.txt - txt files in src/ or tests/
directories
file.{txt,md,json} - file.txt, file.md, or file.json
# Configuration files (directly in input_path)
*.{json,yaml,toml,ini}
# Rust files under src/
src/**/*.rs
# All documentation, at any depth
**/*.{md,txt,rst}
# Test files
{tests,test}/**/*.rs
**/*_test.rs
**/test_*.rs
# Images
**/*.{png,jpg,jpeg,gif,svg,webp}
# Nested package files
**/Cargo.toml
**/package.json
# Everything in a specific directory
assets/**
# Files at specific depth
*/*.rs # One folder below input_path
*/*/*.rs # Two folders below input_path
There is no negation inside a pattern: a ! starting a pattern or an
alternative (!*.tmp, {**/*.rs,!target/**}) is refused with an
error. Put what you want to leave out in -e. ([!...], one
character not in a set, is not negation and works.)
# All Rust files except those in target/
auditor hash input_path -i "**/*.rs" -e "target/**"
# Everything except hidden files and hidden folders (at any depth)
auditor hash input_path -e "**/.*" "**/.*/**"
**/.* alone leaves out hidden files, but not the files inside a hidden
folder: **/.*/** covers those.
Matching follows the operating system: on Windows it ignores case
(*.TXT matches a.txt), on Linux and macOS it does not.
To get the same result everywhere:
**/(?i)*.txt - ignore case in what follows (?i)
((?-i) respects it). Do not put the flag first:
(?i)**/*.txt is refused**/*.[tT][xX][tT] - the same with character classes* never matches / - use ** to
cross directories
** should typically be used alone between separators:
**/ or /**
input_path
(src/app.json), never against the full path
{} for multiple alternatives to keep patterns
readable
auditor hash input_path -i "..." -l
prints the selected files (with their hashes) without creating audit files