Notes on Separators and Case

Specifying Rules on the Command Line

Rules may be specified on the command line (e.g. "--exclude PATTERN") or read from a file (e.g. "--exclude-from=FILE") to make async skip or include certain directories and files. The following command-line options can be freely intermixed:

Rules are applied in the order that they are encountered, and the first matching rule (whether including or excluding) takes precedence. For example, if the file "aspera-test" specifies rules W, X and Y, then the options

--include V --exclude-from aspera-test --include Z

apply rules V, W, X, Y, Z (in that order).

IMPORTANT NOTE: Directories and files are visited in strict depth order, so that with the command-line options "--exclude \above\ --include \above\below" the file "\above\below" is never considered. The directory "\above\" is not scanned; thus, "\above\below" has no opportunity to be checked against any rules.

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:]]

"[]" may also contain the following:

Additional Notes on Standard Globbing:

  1. Directory names, file names and glob literal characters may be multibyte unicode. For example, "voilà" is matched by rules "voilà", "voil[àáâ]", "voil[[:alpha:]]" (but not "voil[[=a=]]" or "voil[[.a-grave.]]").
  2. "\" quotes any character literally, including itself. Example: pattern "a\*b\[c[\]]d\?e\\f" matches file name "a*b[c]d?e\f".
  3. Wildcards "*", "[]" and "?" do not match "/", nor a "." immediately after "/" (ie "/.").
    • "abc/def" is not matched by "abc*def", "abc[/]def" or "abc?def"
    • "abc/.def" is not matched by any of "abc/*", "abc/[![:alpha:]]def", or "abc/?def"
    • "abc/.def is matched by "*/.???"

Globbing Extensions

IMPORTANT NOTE: "**" must be bounded by "/" literals, or end-of-string (e.g. "/**/").

The wildcard "/**" is like "*", but also matches "/".

File-type specificity:

Rules that start with "/" are anchored (i.e., the entire string must be matched).

Rule Composition

Example Expected Behavior
--include A --include B
Matches all file or directory names that match A or B.
--include A --exclude B
Matches all file or directory names that match A; of the rest, excludes all that match B.
--exclude B --include A
Excludes all file or directory names that match B; of the rest, matches those that match A.
--exclude-from=FILE1 --include-from=FILE2
Read filter specifications from FILE1 and FILE2
  • Rules in the file are appended as if from a series of "--include A --exclude B" options
  • Lines that start with "+ " or plus, space, (e.g., "+ A"), are equivalent to the option "--include A"
  • Lines that start with "- " or minus, space (e.g., "- B"), are equivalent to the option "--exclude B"
  • Lines that start with ".+ " or dot, plus, space (e.g., ".+ F"), are equivalent to the option "--include-from=F"
  • Lines that start with ".- " or dot, minus, space (e.g., ".+ G"), are equivalent to the option "--exclude-from=G"
  • Lines that start with ". " or dot, space, name a file to read for more rules, but without a default (i.e., each line must start with one of the above commands).
  • Other lines default to include (for --include-from) or exclude (for --exclude-from) rules
  • Leading white space, blank lines and comment lines ("# comment") are ignored

IMPORTANT NOTE: A file or directory name that does not match any rule is still tracked, as if by a final "+ * and "+ .*". Also, to reliably exclude all unmatched files, add two final rules: "- *" and "- .*".

Semantics

Excluded new files are invisible to async. Files that have been synced already continue to be tracked even when they have, or get, a name that is now excluded. When run with "--exclude FILE3":

Local event Effect on peer (previously synced) Clean start
mv FILE4 FILE3 mv FILE4 FILE3 rm FILE4
rm FILE3 rm FILE3 (ignored)
cp FILE4 FILE3 cp FILE4 FILE3 (ignored)
mv FILE3 FILE4 mv FILE3 FILE4 new file FILE4