From: Jim on 5 Mar 2010 15:25 I have come up with this problem, searched the archives but did not find a good solution. 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! Jim
From: Jim on 5 Mar 2010 15:35 I could do sth like find . -type f -name "*.mbox" | xargs tar cvf mbox.tar and then scp to another server and then untar but is there a way to eliminate the need for mbox.tar(the temporary tar file)? Thank you! Jim
From: Harry on 5 Mar 2010 17:59 On Mar 5, 12:35 pm, Jim <student.northwest...(a)gmail.com> wrote: > I could do sth like > find . -type f -name "*.mbox" | xargs tar cvf mbox.tar and then scp to > another server and then untar > > but is there a way to eliminate the need for mbox.tar(the temporary > tar file)? find . -type f -name "*.mbox" | tar cf - | ssh user(a)server "cd somedir ; tar xf -"
From: Sven Mascheck on 6 Mar 2010 07:39 Harry wrote: > [...] ssh user(a)server "cd somedir ; tar xf -" [...] ssh user(a)server "cd somedir && tar xf -" don't risk the non-accessible directory
From: Jim on 6 Mar 2010 10:39 Thank you Harry and Sven, it works too well! Jim
|
Next
|
Last
Pages: 1 2 Prev: How to list all calls to external programs in a bash script Next: system calls |