Gnuru.org
Productive Linux


Subscribe

 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Login
Login:
Password:



Don't have an account?
Sign up to Gnuru.org
Forgot your password?

Moving an entire directory structure
30 March 2004 @ 11:23 BST
by Paul

This is a FAQ. Mostly when you are moving a directory from one file system to another you want to keep file permissions and ownershops, which, using cp on its own my not do.

One solution is from the Tips HOWTO and was originally suggested by Alan Cox with an amendment of Jim Dennis:

(cd /source/directory && tar cf - . ) | (cd /dest/directory && tar xvfp -)

Using tar, like this makes sure that permissions and ownerships are maintained. Another way may be to use the excellent rsync tool:

rsync -avz /src/foo /dest
Tags: disk files



Leave a comment:

Are you human?