Enterprise Server Configuration and Transfer Reference / ascp: Transferring from the Command Line |
Below are examples of using the ascp command to manipulate files.
Upload a directory, /content/, to the remote server 10.0.0.1. The following produces /storage/content/* on the remote server:
# ascp /data/content/ root@10.0.0.1:/storage/
Upload only the contents of /content/ to the remote server, stripping the srcbase path and preserving the rest of the file structure. The following produces /storage/* on the remote server:
# ascp --src-base=/data/content /data/content/ root@10.0.0.1:/storage
Upload /content/ to the remote server and create a new folder, /storage2, to contain it. The following produces /storage2/content/* on the remote server:
# ascp -d /data/content/ root@10.0.0.1:/storage2/
Download the contents of /storage/content/ from the remote server, while stripping the srcbase path and preserving the rest of the file structure. The following produces /data/* on the local machine:
# ascp --src-base =/storage/content root@10.0.0.1:/storage/content/ /data
Upload a file, /monday/file1and a directory, /tuesday/*, to the /storage directory on the remote server, while stripping the srcbase path and preserving the rest of the file structure. The following produces /storage/monday/file1and /storage/tuesday/* on the remote server:
# ascp --src-base=/data/content /data/content/monday/file1 /data/content/tuesday/ root@10.0.0.1:/storage
Download a file, /monday/file1, and a directory, /tuesday/*, from the remote server, while stripping the srcbase path and preserving the rest of the file structure. The following produces /data/monday/file1 and /data/tuesday/* on the local machine:
# ascp --src-base=/storage/content root@10.0.0.1:/storage/content/monday/file1 root@10.0.0.1:/storage/content/tuesday/ /data
Remove /content/ from the local machine after its contents (excluding partial files) have been transferred to the remote server. The following produces /storage/content/* on the remote server:
# ascp -k2 -E "*.partial" --remove-after-transfer --remove-empty-directories /data/content root@10.0.0.1:/storage
Remove /content/ from the local machine after the contents (excluding partial files) have been transferred to the remote server, while stripping the srcbase path and preserving the rest of the file structure. The following produces /storage/* on the remote server:
# ascp -k2 -E "*.partial" --src-base=/data/content --remove-after-transfer --remove-empty-directories /data/content root@10.0.0.1:/storage