Transferring from the Command Line |
Examples of manipulating files using the ascp command.
This topic demonstrates file manipulation using the ascp command with the following examples:
Upload the "/content/" directory to the remote server.
$ ascp /data/content/ root@10.0.0.1:/storage/
Result => /storage/content/*
Upload the "/content/" directory to the remote server, but strip the srcbase path and preserve the rest of the file structure.
$ ascp --src-base=/data/content /data/content/ root@10.0.0.1:/storage
Result => /storage/*
Upload the "/content/" directory to the remote server and create the "/storage2" folder since it does not exist.
$ ascp -d /data/content/ root@10.0.0.1:/storage2/
Result => /storage2/content/*
Download the "/content/" directory to the remote server, but strip the srcbase path and preserve the rest of the file structure.
$ ascp --src-base =/storage/content root@10.0.0.1:/storage/content/ /data
Result => /data/*
Upload the selected file and directory to the remote server, but strip the srcbase path and preserve the rest of the file structure.
$ ascp --src-base=/data/content /data/content/monday/file1 /data/content/tuesday/ root@10.0.0.1:/storage
Results => /storage/monday/file1 AND /storage/tuesday/*
Download the selected file and directory from the remote server, but strip the srcbase path and preserve the rest of the file structure.
$ ascp --src-base=/storage/content root@10.0.0.1:/storage/content/monday/file1 root@10.0.0.1:/storage/content/tuesday/ /data
Results => /data/monday/file1 AND /data/tuesday/*
Remove the "/content/" directory of the local computer after the contents (excluding partial files) have been transferred to the remote computer.
$ ascp -k2 -E "*.partial" --remove-after-transfer --remove-empty-directories /data/content root@10.0.0.1:/storage
Result => /storage/content/*
Remove the "/content/" directory of the local computer after the contents (excluding partial files) have been transferred to the remote computer. Strip the srcbase path and preserve the rest of the file structure
$ ascp -k2 -E "*.partial" --src-base=/data/content --remove-after-transfer --remove-empty-directories /data/content root@10.0.0.1:/storage
Result => /storage/*