Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy / Move entire directory tree 3

Status
Not open for further replies.

sharadmarathe

IS-IT--Management
Jun 20, 2001
36
US
Hello

I want to move (if not possible, copy) one directory tree to another directory.

What is the syntax for doing this using tar and/or cpio.

Thanks in advance

Sharad
 
Why use tar?

Why not -

cp -R /mydir/myfiles /yourdir/yourfiles

or

mv /mydir/myfiles /yourdir/yourfiles

Steve
 
Many thanx for prompt reply.

cp -R works fine. But I think using tar - cpio the file permissions and ownerships remain intact.

Sharad
 
OK

Try cp -Rp - the "p" preserves permissions.

Steve
 
if you want use tar or cpio and preserve file permissions and ownership
tar:
#cd /old
#tar cpf - . | (cd /new;tar xpf - . )
cpio
# cd /old
#find . | cpio -pdmv /new


Regards,

Carlos Almeida,
 
What I use is:
cd to the directory you want to move.
find . -depth -print | cpio -mvdp /<targetpath>/<targetdir>
 
Hello

Many thanx for your help.

All suggestions helped me lot.

Thanx again

Sharad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top