Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'tar works just as well in most cases' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
tar works just as well in most cases
Authored by: devlogic on Nov 16, '05 10:38:16PM
I dunno; I never really got to like using 'cp -R'; I learned a trick with multiple piped tar's a while back, and have pretty much used it exclusively since then:

tar cf - [source] | (cd [destination] && tar xvf -)
does a great job for everything I've ever needed it for. Plus it has the added benefit that it can be piped through things like ssh (or rsh if you're brave):
tar cf - [source] | ssh username@other.server tar xvf - -C [destination]
Toss a '-p' in the arguments for each tar, and you even get the permissions translated across. Do the command as root (on both sides, mind, if you're using the ssh cross-server method), and the ownership isn't even modified; UID and GID are preserved. Of course if you are moving files between servers, it's necessary to remember that these commands use numeric UID/GIDs and not usernames; user "johnsmith" might be uid 501 on one system, but 502 or 1006 on another.

[ Reply to This | # ]
tar works just as well in most cases
Authored by: derekhed on Nov 18, '05 11:54:40AM

So... do you put the ending slash on [source] and [destination]? :-)



[ Reply to This | # ]