1 |
Tuesday 30 May 2006 19:23 skrev Hamish Marson: |
2 |
> Just be careful with this one. If the destination directory doesn't |
3 |
> exist, then you'll overwrite the sourcefiles with the first block... |
4 |
> Ooops... (Having said that, it's still my favourite way of copying |
5 |
> lots of files from one place to another). |
6 |
|
7 |
That's why it should be like this: |
8 |
|
9 |
# cd /sourcedir && tar -cpf - . | (cd /destdir && tar -xvpf -) |
10 |
|
11 |
Then it will fail and abort if any of the cd operations fails. Also the |
12 |
destdir should be given either as an absolute path or relative to the |
13 |
sourcedir (not relative to whatever your path is when you issue the command |
14 |
above. |
15 |
|
16 |
With GNU tar one can simply do this: |
17 |
|
18 |
# tar -C /sourcedir -cpf - . | tar -C /destdir -xvpf - |
19 |
|
20 |
-- |
21 |
Bo Andresen |