Filters
When listing directories or performing one-at-a-time folder transfers, you can limit the results by applying glob-like patterns to each base file name. The -P or PatternMatch option specifies one or more patterns to apply.
Each pattern will be matched against the base name of local and remote files. Non-matching files will not be transferred. Filters are only applied to the base names of regular files and symbolic links. Filters are applied after scanning and will not reduce the time it takes to scan.
Syntax
The IncludePattern takes the form of a semi-colon separated list of glob-like patterns with similar syntax to the Linux fnmatch function. They work like typical shell globbing, with the following distinctions:
- ASCII Roman letters are case-insensitive.
- Multiple patterns may be separated by semi-colons.
- Each pattern must be less than 254 bytes under UTF-8 encoding.
- If no wildcards, escapes, or semi-colons are present, an asterisk will be placed at the start, end, and between all words.
- A ! character at the start of the string will negate the entire result: matching names will be excluded.
For example, "*.pdf;*.txt;*.doc" will match only files with the extension PDF, TXT, or DOC.
Remember that in most shell environments, the * character must be quoted or escaped on the command line to avoid shell globbing.
See Also
Wildcards are used to match top-level names on the command line, while PatternMatch filters apply to file names inside listings and folder transfers.