scp question

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Mike Starke
Date:  
Subject: scp question
On Thu, Sep 11, 2003 at 02:51:22PM -0700, Kurt Granroth wrote:
/_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

Thanks for addressing the wildcard issue. That was the root
of the problem and it is always nice to solve the root of your
issue rather than an alternative solution.

v/r
-mike