This is current/amd64.
When copying multiple files from a remote host using scp(1)
into a local directory that does not exist, or to local file,
the result is that the last copied file wins.
For example, with file1 and file2 at host,
and /tmp/nonexistent not existing at the destination,
scp host:file* /tmp/nonexistent
will result in /tmp/nonexistent being a copy of file2
and file1 being nowhere.
In case /tmp/nonexistent exists and is a file,
the same happens.
In case /tmp/nonexistent exists and is a dir,
both file1 and file2 get copied there, as with cp(1).
Is this behaviour intended?
Reading the output of 'scp -v' I see
Sending command: scp -v -f file*
Reading the scp(1) manpage and the getopt() in scp.c,
i see the undocummented -d -f options; with -d,
scp exists immediately with
/tmp/nonexistent: No such file or directory
/tmp/nonexistent: Not a directory
respectively; but it seems strange that the user has to
explicitly say "I am copying multiple files into a directory",
as opposed cp(1) doing that automatically.
Jan
No comments:
Post a Comment