Applying Filters to Include and Exclude Files

Specifying Rules on the Command Line

Filtering rules may be specified on the command line to make ascp skip or include specific directories and files. The following command-line options can be freely intermixed:

-E pattern
Exclude files or directories matching pattern.
-N pattern
Include files or directories matching pattern.

Rules are applied in the order they are encountered, and the first matching rule takes precedence (regardless of whether -E or -N). For example, if the following options are specified, rule1, rule2, rule3, and rule4 are applied in that order:

-N rule1  -E rule2  -E rule3  -N rule4

Directories and files are visited in strict depth order, so that with the command-line options -E /above/ -N /above/below , the file /above/below is never considered. Because the directory /above/ is not scanned, /above/below has no opportunity to be checked against any rules.

Note: If rules are specified in aspera.conf, they are applied first.

Notes on Path Separators, Case, and Quotation Marks

Individual Matching Rules

Rules applied to directory and file names are limited regular expressions (referred to as "globs" in UNIX terminology).

Standard Globbing, as in POSIX sh(1) and find(1)

* ? [abc] [a-z] *.[!cos] *.[^cos] [![:digit:][:blank:]]

Globbing Extensions

Rule Composition

Example Expected Behavior
-N rule1 -N rule2 Includes all file or directory names that match rule1 or rule2.
-N rule1 -E rule2 Includes all file or directory names that match rule1; of those, it excludes all that match rule2.
-E rule2 -N rule1 Excludes all file or directory names that match rule2; of the rest, it includes those that match rule1.

An anchored rule -N /a/b/c matches directories /a/ and /a/b/ in addition to file /a/b/c . There is no such extension for -E a/b/c .

A rule containing /** bounds this extension. That is, -N "/a/b/**/c/d" matches directories /a and /a/b , but not the /a/b/c directory.

A file or directory name that does not match any rule is still tracked, as if by a final -N "*" . To exclude all unmatched files reliably, add -E "*" as the final rule.