Resuming file transfers with ascp

Description

The ascp program allows you to transfer files with FASP using the command line. The command can take several options for applying settings to each transfer, such as setting the target transfer rate or encrypting your files, to name a few.

With the -k option you can enable files that only partially transferred due to an interruption or pause to continue transferring according to a specified resume rule. By default interrupted transfers are transferred all over again in their entirety, but you may want to continue transfers from their point of stoppage instead.

When a transfer is in progress, a file with the same name as the transfer file and an extension of .aspx is created at the destination. This file keeps track of the transfer progress (specifically, the last byte of the file transferred in which all the bytes that come before it have also been received) and is removed once the transfer completes. When file transfer resuming is enabled, this file is used to continue file transfers from the last recorded contiguous byte.

Note: The .aspx files should not be used by your scripts to determine whether a file has been completely transferred or not. They are strictly a tool for ascp to track how much of the transfer has finished. You should instead use the .partial files as an indication of whether the transfer has completed.

Usage

The -k option must be specified on your first transfer, otherwise it will not work on subsequent transfers.

The option is used as follows:

ascp -k{0|1|2|3} [[user@]srcHost:]source_file1[,source_file2,...] [[user@]destHost:]target_path


The k option takes a numerical argument to specify the resume rule for the transfers. The rules are the following:

  • 0 (default) - Always retransfer the entire file.
  • 1 - Check file attributes and resume the transfer if the current and original attributes match.
  • 2 - Check file attributes and do a sparse file checksum. Resume the transfer if the current and original attributes/checksums match.
  • 3 - Check file attributes and do a full file checksum. Resume the transfer if the current and original attributes/checksums match.


Note that when a complete file exists at the destination (no .aspx), the source file size is compared with the destination file size. When a partial file and a valid .aspx file exist at the destination, the source file size is compared with the file size recorded inside the .aspx file.     

Examples

To enable transfers to resume if the current and original file attributes match, you would use the following:

ascp -k 1 local-dir/files UserName@10.0.0.2:/remote-directory

 

To enable transfers to resume after a sparse file checksum and attribute/checksum match, you would use the following:

ascp -k 2 local-dir/files UserName@10.0.0.2:/remote-directory
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk