Tuesday 30 May 2006 19:23 skrev Hamish Marson:
> Just be careful with this one. If the destination directory doesn't
> exist, then you'll overwrite the sourcefiles with the first block...
> Ooops... (Having said that, it's still my favourite way of copying
> lots of files from one place to another).

That's why it should be like this:

# cd /sourcedir && tar -cpf - . | (cd /destdir && tar -xvpf -)

Then it will fail and abort if any of the cd operations fails. Also the 
destdir should be given either as an absolute path or relative to the 
sourcedir (not relative to whatever your path is when you issue the command 
above.

With GNU tar one can simply do this:

# tar -C /sourcedir -cpf - . | tar -C /destdir -xvpf - 

-- 
Bo Andresen

Attachment: pgpufxMWavMr5.pgp
Description: PGP signature

Reply via email to