msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

23 Jan 2009 Copy files using tar

Posted by

This is a oneliner to copy files from current directory to another target directory using tar, preserving file attributes, dates etc.

#!/bin/sh

fromdir=/path/from
todir=/path/to/target

echo "cd $fromdir; tar cf - . | (cd $todir; tar xpf -)"

cd $fromdir; tar cf - . | (cd $todir; tar xpf -)

Tags: , ,

Comments are closed.