| ascp: Transferring from the Command Line with Ascp |
126
Where
sourcefile
contains the following:
File: myfile1
Size: 1025
<< 1025 bytes of data>>
File: myfile2
Size: 20
<<20 bytes of data>>
Using Filters to Include and Exclude Files
Filters refine the list of source files (or directories) to transfer by indicating which to skip or include based on name
matching. When no filtering rules are specified by the client, Ascp transfers all source files in the transfer list; servers
cannot filter client uploads or downloads.
Command Line Syntax
-E
'
pattern
' Exclude files or directories with names or paths that match
pattern
.
-N
'
pattern
' Include files or directories with names or paths that match
pattern
.
Where:
•
pattern
is a file or directory name, or a set of names expressed with UNIX
glob
patterns.
• Surround patterns that contain wildcards with single quotes to prevent filter patterns from being interpreted by the
command shell. Patterns that do not contain wildcards can also be in single quotes.
Basic usage
• Filtering rules are applied to the transfer list in the order they appear on the command line. If filtering rules are
configured in
aspera.conf
, they are applied before the rules on the command line.
• Filtering is a process of exclusion, and
-N
rules override
-E
rules that follow them.
-N
cannot add back files that
are excluded by a preceding exclude rule.
• An include rule
must
be followed by at least one exclude rule, otherwise all files are transferred because none are
excluded. To exclude all files that do not match the include rule, use
-N '/**/' -E '/**'
at the end of your
filter arguments.
• Filtering operates only on the set of files and directories in the transfer list. An include rule (
-N
) cannot add files
or directories that are not already part of the transfer list.
Example
Transfer Result
-E
'
rule
'
Transfer all files and directories except those with names that match
rule
.
-N
'
rule
'
Transfer all files and directories because none are excluded.
To transfer only the files and directories with names that match
rule
use:
ascp -N '
rule
' -N '/**/' -E '/**'
-N
'
rule1
'
-E
'
rule2
'
Transfer all files and directories with names that match
rule1
, as well as all other files
and directories except those with names that match
rule2
.
-E
'
rule1
'
-N
'
rule2
'
Transfer all files and directories except those with names that match
rule1
. All files
and directories not already excluded by
rule1
are included because no additional
exclude rule follows
-N '
rule2
'
.