How do I copy all files with scp in 1 command?

D. Hugh Redelmeier hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Thu May 16 15:36:00 UTC 2013


| From: Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org>

| On Wed, May 15, 2013 at 03:10:51PM -0400, waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org wrote:

| > scp * new_machine:/home/waltdnes/
| > scp \.* new_machine:/home/waltdnes/
| > 
| >   Is there a simpler way that works with 1 command?
| 
| scp * \.* new_machine:/home/waltdnes/
| 
| Is that simpler?

What's the \ for?  "." isn't a shell metacharacter.

".*" is scary since it matches "." and "..".  But scp with no flags
won't copy directories, so it's kind of OK.

But I would think one would want to copy directories.

This might be closer to what is wanted.
	scp -pr * .[^.]* new_machine:/home/waltdnes/
That's assuming nothing interesting starts with "..".
If there were such a thing, add "..?*" (if you put it in, and it
doesn't match anything, you will get an error message because it
will treat it as a literal filename).

Gnume (I think) plants a named pipe (I think) in a subirectory of your
home diretory.  scp will probably whine about copying it if it comes
across it.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list