A4 Command Reference

Supported environment variables, the general syntax, and command options for A4 are described in the following section. ascp4 exits with a 0 on success or a 1 on error. The error code is logged in the ascp4 log file.

Important:

Environment Variables

If needed, you can set the following environment variables for use with the ascp4 command.

Item Setting
Password ASPERA_SCP_PASS=password
Token ASPERA_SCP_TOKEN=token
Cookie ASPERA_SCP_COOKIE=cookie

ascp4 Syntax

ascp4 options [[user@]srcHost:]source_file1[,source_file2,...] [[user@]destHost:]target_path

User

If you do not specify a username for the transfer, the local username is authenticated by default.

Note: If you are authenticating on a Windows machine as a domain user, the transfer server strips the domain from the username. For example, Administrator is authenticated rather than DOMAIN\Administrator. Thus, you must specify the domain explicitly.

Target path

If there are multiple source arguments, then the target path must be a directory.

To describe filepaths, use single-quote (' ') and forward-slashes (/) on all platforms. Avoid the following characters in filenames: / \ " : ' ? > < & * |.

URIs are supported in paths, but only under the following restrictions:

Ascp4 Options

Option Description
-h, --help Display usage reference, then exit.
-A, --version Display version and license information, then exit.
-T Disable encryption for maximum throughput.
-p Preserve file timestamps for source modification time (mtime) and last access time (atime).

Important: On Windows, mtime and atime can be affected when the system automatically adjusts for Daylight Savings Time (DST). For details, see the Microsoft KB article, http://support.microsoft.com/kb/129574.

-q Quiet mode. This option disables the progress display.
-l max_rate Set the target transfer rate. (Default: 10 Mbps) This option accepts suffixes "G/g" for Giga, "M/m" for Mega, "K/k" for Kilo, and "P/p/%" for percentage, and decimals are allowed. If the client does not specify a target rate, the server target rate is used. If local or server rate caps are specified, the "starting" (default) rate does not exceed the cap.
-m min_rate Set the minimum transfer rate in Kbps. (Default: 0) If the client does not specify a minimum rate, the server minimum rate is used. If local or server rate caps are specified, the "starting" (default) rate does not exceed the cap.
-i private_key_file Use public key authentication and specify the private key file. Typically, the private key file is in the directory $HOME/.ssh/.
-Z dgram_size Specify the datagram size (MTU) for FASP. By default, the detected path MTU is used. (Range: 296 - 10000 bytes)

Note: As of version 3.3, datagram size can be enforced by setting <datagram_size> in aspera.conf on the server. If size is set with both -Z (client side) and <datagram_size> (server side), the server setting is used. If the client-side is pre-3.3, datagram size is determined by the -Z setting, regardless of the server-side setting for <datagram_size>. If pre-3.3 client does not specify -Z, then datagram size is based on the discovered MTU and the server logs the message "LOG Peer client doesn't support alternative datagram size".

-X rexmsg_size Set the maximum size of a retransmission request in bytes. (Max: 1440).
-L local_log_dir Specify a local logging directory.
-R remote_log_dir Specify a remote logging directory. Note: Client users that are restricted to aspshell are not allowed to use this option.
-O fasp_port Set the UDP port for FASP transfers. (Default: 33001)
-P ssh-port Set the TCP port for FASP session initiation. (Default: 22)
-E pattern

-N pattern

Exclude (-E) or include (-N) files or directories with the specified pattern from the transfer. Up to 16 -E and -N patterns can be used. The following two symbols can be used in the pattern:
  • * (asterisk) represents zero or more characters in a string, for example *.tmp matches .tmp and abcde.tmp.
  • ? (question mark) represents a single character, for example t?p matches tmp but not temp.

Rules are applied in order, and each rule is applied to the files that were filtered by the preceeding rules.

--mode=mode Specify the transfer direction, either send or recv. Requires --host.
--host=host The server's hostname or address. If a value is not provided, the source files or the target path must specify the host name as "host:filename". Requires --mode.
--policy=xfer_policy Set the transfer policy, which can be any of the following:
  • fixed – Attempts to transfer at the specified target rate, regardless of the actual network capacity. This policy transfers at a constant rate and finishes in a guaranteed time. This policy can occupy most of the network's bandwidth, and is not recommended in most file transfer scenarios. Requires a maximum (target) rate value.
  • high – Monitors the network and adjusts the transfer rate to fully utilize the available bandwidth up to the maximum rate. When congestion occurs, the transfer rate is twice as fast as fair. Requires both the maximum (target) and the minimum transfer rates.
  • fair – Monitors the network and adjusts the transfer rate to fully utilize the available bandwidth up to the maximum rate. When congestion occurs, bandwidth is shared fairly by transferring at an even rate. Requires both the maximum (target) and the minimum transfer rates.
  • low – Similar to fair mode, the low policy uses the available bandwidth up to the maximum rate, but is less aggressive. When congestion occurs, the transfer rate is reduced to the minimum rate until other traffic retreats.

If --policy is used, it is reflected in the GUI. If --policy is not used, ascp4 uses the server-side setting (fair by default).

--user=username The username authenticated by the transfer server. If you do not specify a username for the transfer, the local username is authenticated by default.
Note: If you are authenticating on a Windows machine as a domain user, the transfer server strips the domain from the username. For example, Administrator is authenticated rather than DOMAIN\Administrator. Thus, you must specify the domain explicitly.
--src-base=prefix Specify the prefix that is deleted from the file path of each source object. The remaining portion of the source path is kept intact at the destination. Available only in send mode (--mode=send).

Example: Using --src-base

The directory /clips on the server contains the following folders and files:

/clips/outgoing/file1
/clips/outgoing/folderA/file2
/clips/outgoing/folderB/file3 

To transfer all the folders and files in /clips/outgoing (but not /outgoing itself) to the /incoming directory at the destination, run the following command:

# ascp4 -d --src-base=/clips/outgoing/ root@10.0.0.1:/clips/outgoing/ /incoming  

At the destination, the following folders and files appear in /incoming:

(docroot)/incoming/file1
(docroot)/incoming/folderA/file2
(docroot)/incoming/folderB/file3 

Files outside of the source base (for example, /temp/file4) are not transferred, and warnings are generated.

Example: Without --src-base

If the source item is a folder and --src-base is not used, then the contents of the folder and the folder itself are transferred. For example, run the same command as in the previous example but without --src-base:

# ascp4 -d root@10.0.0.1:/clips/outgoing/ /incoming  

At the destination, the following folders and files appear in /incoming:

(docroot)/incoming/outgoing/file1
(docroot)/incoming/outgoing/folderA/file2
(docroot)/incoming/outgoing/folderB/file3
If the source object is a single file and --src-base is not used, then only the file is transferred. For example:
# ascp4 -d root@10.0.0.1:/clips/outgoing/file1 root@10.0.0.1:/clips/outgoing/folderA/file2 /incoming

At the destination, the following files appear in /incoming:

(docroot)/incoming/file1
(docroot)/incoming/file2
--file-list=filename Specify the source content in a file that contains a list of filepaths. The file list supports UTF-8 files and input from standard input through "-". The sources can exist on either the local host or the remote host (in terms of download), but not on both. Each source must be specified on a separate line:
  • src
  • src2
  • ...
  • srcN

Important:

  • Multiple --file-list options are not supported in one ascp4 command. If multiple file lists are specified, all but the last are ignored. In addition, you cannot include file names in a command with --file-list. Only files from the file list are transferred.
  • Paths in file lists cannot use user@host:filepath syntax. You must use --user with --file-list.
--faspmgr-io Run A4 in API mode using FASP manager I/O. A4 reads FASPMGR4 commands from management and executes them. The FASPMGR4 commands are PUT/WRITE/STOP to open/write/close on a file on the server.
--delete-before Delete files that exist at the destination but not at the source before starting the transfer. Objects in the destination with the same name but different type or size as objects in the source are not deleted. Requires write permissions on the destination. Do not use with multiple sources, keepalive, URI storage, or HTTP fallback.

Using --delete-before can be faster than --delete-after because the destination data set used to compare objects may be smaller before the transfer occurs.

Can also be specified as --delete-before-transfer.

--delete-after Delete files that exist at the destination but not at the source after all files are transferred. Objects in the destination with the same name but different type or size as objects in the source are not deleted. Requires write permissions on the destination. Do not use with multiple sources, keepalive, URI storage, or HTTP fallback.

Using --delete-after can be slower than --delete-before because the destination data set used to compare objects may be larger after the transfer occurs.

Can also be specified as --delete-after-transfer.

--preserve-file-owner-uid Preserve the owner information (uid) of transferred files.

Note: Requires that the transfer user be authenticated as a superuser.

--preserve-file-owner-gid Preserve group information (gid) of transferred files.

Note: Requires that the transfer user be authenticated as a superuser.

--preserve-access-time Preserve the file timestamps (same as -p).
--preserve-source-access-time Preserve the file timestamps (same as -p).
--preserve-modification-time Preserve the file timestamps (same as -p).
--preserve-creation-time Preserve the file timestamps (same as -p).
--chunk-size=bytes Buffer size that is used for storage read/write operations as well as for an internal transmission and compression "unit". Valid range: 4 kb - 128 Mb.
--read-threads=num Number of storage "read" threads (sender only). Default: 2.
--write-threads=num Number of storage "write" threads (receiver only). Default: 2.
Note: For ascp4 transfers to object or HDFS storage, write threads cannot exceed the maximum number of jobs configured for Trapd (default: 15). To use more threads, open /opt/aspera/etc/trapd/trap.properties on the server and set the value for aspera.session.upload.max-jobs to one larger than the number of write threads. For example,
# Number of jobs allowed to run in parallel for uploads.
# Default is 15
aspera.session.upload.max-jobs=50
--scan-threads=num Number of directory "scan" threads (sender only). Default: 2.
--meta-threads=num Number of directory "creation" threads (receiver only). Default: 2.
--compression=method Compress file data inline. The method can be one of: none, zlib, or lz4. Default is lz4.
--compression-hint=num For use with compression algorithms that allow you to set compression level (currently only zlib). A lower value results in less, but faster, data compression (0 = no compression). A higher value results in greater, slower compression. Acceptable values are -1 to 9, where -1 is "balanced". Default: -1.
--compare=method The compare method can be size, size+mtime, md5, md5-sparse, sha1, or sha1-sparse. If the --overwrite method is diff or diff+older, the default compare method is size.
--overwrite=method Overwrite files at the destination with source files of the same name. (Default: always) This option can use the following methods:
  • always – Always overwrite the file.
  • never – Never overwrite the file. If the destination contains partial files that are older or the same as the source files and resume is enabled, the partial files resume transfer. Partial files with checksums or sizes that differ from the source files are not overwritten.
  • diff – Overwrite if the file is different from the source, depending on the compare method (default is size). If resume is not enabled, partial files are overwritten if they are different from the source, otherwise they are skipped. If resume is enabled, only partial files with different sizes or checksums from the source are overwritten; otherwise, files resume.
  • diff+older – Overwrite if the destination is older and different from the source, depending on the compare method (default is size). If resume is not enabled, partial files are overwritten if they are older and different from the source, otherwise they are skipped. If resume is enabled, only partial files that are different and older than the source are overwritten, otherwise they are resumed.
  • older – Overwrite if the destination timestamp is older than the source timestamp.
--resume Resume a copy rather than retransfer if partial files are present at the destination and they do not differ from the source file based on the compare method. If the files no longer match, then the source file is retransferred.
-k resume_level Enable resumption of partial transfers. The resume_level can be 0 (default), 1, 2, or 3.
  • -k 0: Always retransfer the entire file (same as --overwrite=always).
  • -k 1: Check file modification time and size and resume if they match (same as --overwrite=diff --compare=size --resume).
  • -k 2: Check sparse checksum and resume if they match (same as --overwrite=diff --compare=md5-sparse --resume).
  • -k 3: Check full checksum and resume if they match (same as --overwrite=diff --compare=md5 --resume).
--sparse-file Enable A4 to write sparse files to disk. This option prevents A4 from writing zero content to disk for sparse files; A4 writes a block to disk if even one bit is set in that block. If no bits are set in the block, A4 does not write the block (by default A4 blocks are 64K).
--no-read In test mode, do not read the contents of source files.
--no-write In test mode, do not write the contents of destination files.
--no-open In test mode, do not actually open or write the contents of destination files.
--memory=bytes Maximum memory that the local ascp4 process is allowed. Default 256MB.
--remote-memory=bytes Maximum memory that the remote ascp4 process is allowed. Default 256MB.
--exclude-newer-than=mtime

--exclude-older-than=mtime

Exclude files from the transfer based on when the file was last changed. This option does not apply to directories.