From: Ivan Shmakov on 7 Mar 2010 00:49 >>>>> Jim <student.northwestern(a)gmail.com> writes: [...] > I have a directory called archives. I want to find all the files > ending with ".mbox", and I want to scp all those files to another > server. but the trick is that I need to preserve the directory > structure. > I came up with something like > find archives -name "*.mbox" | xargs scp user(a)server:/somedir, but > this does not preserve the directory structure(does not create parent > directory if necessary).. > Thank you for any pointers! It's not quite an answer to the question asked, but why not to try Rsync instead? Like: $ rsync -vaO \ --include=\*/ \ --include=\*.mbox \ --exclude=\* \ archives/ \ user(a)server:/somedir/ Obviously, Rsync should be installed on both the local and the remote host. Note that a slash ('/') after a source directory name is significant. Namely, $ rsync ... from user(a)server:/to/ is (roughly) equivalent to: $ rsync ... from/ user(a)server:/to/from/ It may be said that 'from' refers to the directory, while 'from/' refers to its /contents/. -- FSF associate member #7257
First
|
Prev
|
Pages: 1 2 Prev: How to list all calls to external programs in a bash script Next: system calls |