| ascp: Transferring from the Command Line with Ascp |
123
A named pipe can be specified as a stdio destination, with the syntax
stdio:///
path
for single files, or
stdio-
tar:///
path
for multiple files, where
path
is the path of the named pipe. If a docroot is configured on the
destination, then the transfer goes to the named pipe
docroot
/
path
.
Note:
Do not use
stdio:///
path
to transfer multiple files. The file data is asynchronously concatenated in the
output stream and might be unusable. Use
stdio-tar:///
path
instead, which demarcates multiple files with
headers.
Single File Transfers
To upload data that is piped into stdin, set the source as
stdio:///?
fsize
, where
fsize
is the number of bytes (as
a decimal) that are received from stdin. The destination is set as the path and filename. The file modification time is
set to the time at which the upload starts. Standard input must transfer the exact amount of data that is set by
fsize
. If
more or less data is received by the server, an error is generated.
To download data and pipe it into stdout, set the destination as
stdio://
.
Restrictions:
•
stdio://
cannot be used for persistent sessions. Use
stdio-tar://
instead.
• Only
--overwrite=always
or
--overwrite=never
are supported with
stdio://
. The behavior of
--
overwrite=diff
and
--overwrite=diff+older
is undefined.
Single-file Transfer Examples:
• Upload 1025 bytes of data from the client stdin to
/remote-dir
on the server at 10.0.0.2. Save the data as the
file
newfile
. Transfer at 100 Mbps.
file_source
| ascp -l 100m --mode=send --user=
username
--host=10.0.0.2
stdio:///?1025 /remote-dir/newfile
• Download the file
remote_file
from the server at 10.0.0.2 to stdout on the client. Transfer at 100 Mbps.
ascp -l 100m --mode=recv --user=
username
--host=10.0.0.2 remote_file
stdio://
• Upload the file
local_file
to the server at 10.0.0.2 to the named pipe
/tmp/outpipe
. Transfer at 100
Mbps.
ascp -l 100m --mode=send --user=
username
--host=10.0.0.2 local_file
stdio:////tmp/outpipe
Multi-File Transfers
Ascp can transfer one or more files in an encoded, streamed interface, similar to single file transfers. The primary
difference is that the stream includes headers that demarcate data from individual files.
To upload files that are piped into stdin, set the source as
stdio-tar://
. The file modification time is set to the
time at which the upload starts.
The file(s) in the input stream must be encoded in the following format.
File
can be the file name or file path,
Size
is the size of the file in bytes, and
Offset
is an optional parameter that sets where in the destination file to begin
overwriting with the raw inline data:
[0 - n blank lines]
File:
/path/to/file_1
Size:
file_size
Offset:
bytes
file_1 data
[0 - n blank lines]
File:
/path/to/file_2