| ascp: Transferring from the Command Line with Ascp |
127
Example
Transfer Result
To transfer only the files and directories with names that do not match
rule1
but do
match
rule2
use:
ascp -E '
rule1
' -N '
rule2
' -N '/**/' -E '/**'
Filtering Rule Application
Filters can be specified on the
ascp
command line and in
aspera.conf
. Ascp applies filtering rules that are set in
aspera.conf
before
it applies rules on the command line.
Filtering order
Filtering rules are applied to the transfer list in the order they appear on the command line.
1.
Ascp compares the first file (or directory) in the transfer list to the pattern of the first rule.
2.
If the file matches the pattern, Ascp includes it (
-N
) or excludes it (
-E
) and the file is immune to any following
rules.
Note:
When a directory is excluded, directories and files in it are also excluded and are not compared to any
following rules. For example, with the command-line options
-E '/images/' -N '/images/icons/'
,
the directory
/images/icons/
is not included or considered because
/images/
was already excluded.
3.
If the file does not match, Ascp compares it with the next rule and repeats the process for each rule until a match is
found or until all rules have been tried.
4.
If the file never matches any exclude rules, it is included in the transfer.
5.
The next file or directory in the transfer list is then compared to the filtering rules until all eligible files are
evaluated.
Example
Consider the following command:
# ascp -N 'file2' -E 'file[0-9]' /images/icons/ user1@examplehost:/tmp
Where
/images/icons/
is the source.
If
/images/icons/
contains
file1
,
file2
,
and fileA
, the filtering rules are applied as follows:
1.
file1
is compared with the first rule (
-N 'file2'
) and does not match so filtering continues.
2.
file1
is compared with the second rule (
-E 'file[0-9]
) and matches, so it is excluded from the transfer.
3.
file2
is compared with the first rule and matches, so it is included in the transfer and filtering stops for
file2
.
4.
fileA
is compared with the first rule and does not match so filtering continues.
5.
fileA
is compared with the second rule and does not match. Because no rules exclude it,
fileA
is included in
the transfer.
Note:
If the filtering rules ended with
-N '/**/' -E '/**'
, then
fileA
would be excluded because it was
not "protected" by an include rule.
Rule Patterns
Rule patterns (globs) use standard globbing syntax that includes wildcards and special characters, as well as several
Aspera extensions to the standard.
•
Character case:
Case always matters, even if the file system does not enforce such a distinction. For example, on
Windows FAT or NTFS file systems and macOS HPFS+, a file system search for "DEBUG" returns files "Debug"
and "debug". In contrast, Ascp filter rules use exact comparison, such that "debug" does not match "Debug". To
match both, use "[Dd]ebug".
•
Partial matches:
With globs, unlike standard regular expressions, the entire filename or directory name must
match the pattern. For example, the pattern
abc*f
matches
abcdef
but not
abcdefg
.