| ascp: Transferring from the Command Line with Ascp |
117
Upload a file,
/monday/file1
, and a directory,
/tuesday/*
, to the
/storage/
directory on the server,
while stripping the srcbase path and preserving the rest of the file structure. The content is saved as
/storage/
monday/file1
and
/storage/tuesday/*
on the server.
# ascp --src-base=/data/content /data/content/monday/file1 /data/content/
tuesday/ [email protected]:/storage
•
Download only the contents of a file and a directory to a new directory by using
--src-base
Download a file,
/monday/file1
, and a directory,
/tuesday/*
, from the server, while stripping the srcbase
path and preserving the rest of the file structure. The content is saved as
/data/monday/file1
and
/data/
tuesday/*
on the client.
# ascp --src-base=/storage/content [email protected]:/storage/content/monday/
file1 [email protected]:/storage/content/tuesday/ /data
•
Move the source file on the client after it is uploaded to the server by using
--move-after-transfer
Upload
file0012
to Pat's docroot on the server at 10.0.0.1, and move (not copy) the file from
C:/Users/
Pat/srcdir/
to
C:/Users/Pat/Archive
on the client.
# ascp --move-after-transfer=C:/Users/Pat/Archive C:/Users/Pat/srcdir/
file0012 [email protected]:/
•
Move the source file on the server after it is downloaded to the client by using
--move-after-transfer
Download
srcdir
from the server to
C:/Users/Pat
on the client, and move (not copy)
srcdir
to the
archive directory
/Archive
on the server.
# ascp --move-after-transfer=Archive [email protected]:/srcdir C:/Users/Pat
•
Move the source file on the client after it is uploaded to the server and preserve the file structure one level
above it by using
--src-base
and
--move-after-transfer
Upload
file0012
to Pat's docroot on the server at 10.0.0.1, and save it as
/srcdir/file0012
(stripped of
C:/Users/Pat
). Also move
file0012
from
C:/Users/Pat/srcdir/
to
C:/Users/Pat/Archive
on the client, where it is saved as
C:/Users/Pat/Archive/srcdir/file0012
.
# ascp --src-base=C:/Users/Pat --move-after-transfer=C:/Users/Pat/Archive
C:/Users/Pat/srcdir/file0012 [email protected]:/
•
Delete a local directory once it is uploaded to the remote server by using
--remove-after-transfer
and
--remove-empty-directories
Upload
/content/
to the server, then delete its contents (excluding partial files) and any empty directories on
the client.
# ascp -k2 -E "*.partial" --remove-after-transfer --remove-empty-
directories /data/content [email protected]:/storage
•
Delete a local directory once its contents have been transferred to the remote server by using
--src-base
,
--remove-after-transfer
, and
--remove-empty-directories
Upload
/content/
to the server, while stripping the srcbase path and preserving the rest of the file structure.
The content is saved as
/storage/*
on the server. On the client, the contents of
/content/
, including empty
directories but excluding partial files, are deleted.
# ascp -k2 -E "*.partial" --src-base=/data/content --remove-after-transfer
--remove-empty-directories /data/content [email protected]:/storage