glob for filesystem
Signature
> glob {flags} (glob)
Flags
--depth, -d {int}: directory depth to search--no-dir, -D: Whether to filter out directories from the returned paths--no-file, -F: Whether to filter out files from the returned paths--no-symlink, -S: Whether to filter out symlinks from the returned paths--follow-symlinks, -l: Whether to follow symbolic links to their targets--exclude, -e {list<string>}: Patterns to exclude from the search:globwill not walk the inside of directories matching the excluded patterns.
Parameters
glob: The glob expression.
Input/output types:
| input | output |
|---|---|
| nothing | list<string> |
Examples
Search for *.rs files
> glob *.rsSearch for *.rs and *.toml files recursively up to 2 folders deep
> glob **/*.{rs,toml} --depth 2Search for files and folders that begin with uppercase C or lowercase c
> glob "[Cc]*"Search for files and folders like abc or xyz substituting a character for ?
> glob "{a?c,x?z}"A case-insensitive search for files and folders that begin with c
> glob "(?i)c*"Search for files or folders that do not begin with c, C, b, M, or s
> glob "[!cCbMs]*"Search for files or folders with 3 a's in a row in the name
> glob <a*:3>Search for files or folders with only a, b, c, or d in the file name between 1 and 10 times
> glob <[a-d]:1,10>Search for folders that begin with an uppercase ASCII letter, ignoring files and symlinks
> glob "[A-Z]*" --no-file --no-symlinkSearch for files named tsconfig.json that are not in node_modules directories
> glob **/tsconfig.json --exclude [**/node_modules/**]Search for all files that are not in the target nor .git directories
> glob **/* --exclude [**/target/** **/.git/** */]Search for files following symbolic links to their targets
> glob "**/*.txt" --follow-symlinksNotes
For more glob pattern help, please refer to https://docs.rs/crate/wax/latest