If there are multiple file names matching a remote wildcard expression, then "scp machine:wildcard asdf" will, if asdf does not exist, create asdf for the first file and then overwrite it for each additional file. I would rather it print an error without copying anything, or at least print an error without copying more than one file. It's terribly frustrating to watch one file finish and then see it immediately overwritten. For example: $ scp amsterdam:*.c /tmp/a ether82557.c 100% 29KB 29.4KB/s 00:00 sdaoe.c 100% 16KB 15.8KB/s 00:01 sdaow.c 100% 44KB 44.1KB/s 00:00 serial.c 100% 1480 1.5KB/s 00:00 x.c 100% 220 0.2KB/s 00:00 $ ls -l /tmp/a -rw-rw-r-- 1 rsc rsc 220 2005-09-24 22:14 /tmp/a $ Russ Cox rsc@swtch.com
We have this "half right" now, in that scp hosta:foo hosta:bar /tmp/abc will check that /tmp/abc is a directory, but there is no way to know a priori that : scp hosta:* /tmp/abc will yield multiple files. I suppose we could modify sink() to raise an error on the 2nd file transferred, but that isn't optimal either. this is another limitation of the stupid scp "protocol"