How do I copy all files with scp in 1 command?
John Sellens
jsellens-Iv5KO+h6AVB+Y12zHexnB0EOCMrvLtNR at public.gmane.org
Wed May 15 22:46:25 UTC 2013
| From: waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
| Date: Wed, 15 May 2013 15:10:51 -0400
|
| scp * new_machine:/home/waltdnes/
| scp \.* new_machine:/home/waltdnes/
|
| Is there a simpler way that works with 1 command?
scp, like cp and mv, can take multiple source files, and indeed,
you are already doing that - the * expands to multiple files.
Virtually anywhere you use one shell wildcard, you can use more than one.
So:
scp * .??* new_machine:/home/waltdnes/
I use ".??*" to avoid matching . or .. (the directories) and because
I rarely have files named with a period and one character.
As others mentioned, you can of course use scp's -r option, if you
want to recursively copy an entire directory.
scp -p -r . new_machine:/home/waltdnes/
-p means retain dates and owner/group/mode.
And of course, rsync is a good choice as well, especially if your
copy might be interrupted in the middle somewhere:
rsync -av . new_machine:/home/waltdnes/
Hope that helps - cheers!
John
--
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