scp question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kurt Granroth
Date:  
Subject: scp question
On Sep 11, 2:30pm, Mike Starke wrote:
> I would like to issue the command "scp
> :some/path/* ." However, I get the error message
> "scp: No match.".
>
> If I specify the remote file all is well. If I use the wild card
> locally to put files, everything is fine. Just not as descreibed above.
>
> How is this copying done?


This problem is due to the interaction with the shell. When you specify a
wildcard on the command line, the shell will try to expand it out BEFORE
sending it to the command. So you may be intending the '*' to be passed to
scp as-is.. but it's not, it's expanded out (to nothing in your case) first.

There are a couple of ways around this. Off the top of my head and in no
particular order:

o scp can handle username@remote:/some/path/ to mean all the files in the
directory (not the trailing slash)
o Under zsh, you can specify scp like so 'noglob scp' that will tell zsh not
to expand wildcards. This may work in other shells
o Get in the habit of putting all "remote" wildcards in quotes. The quotes
will keep the shell from expanding them