Copying entire directories in UNIX

To copy an entire directory including links and properties (snap-shot), use the find command in conjunction with cpio.

Here's an example for copying all of /usr to /backup-usr (must be root to do this example):

#cd /usr
#find . -print | cpio -pduvm /backup-usr

Then, you can rename the /backup-usr to /usr and you will have no problems with links or system permissions.

About the author: Greg Hearn is a UNIX Systems Administrator at LVVWD.

Editor's Note: We provide user-submitted tips as a service to our members to help foster other comments and advice. This tip has not been checked in detail for its technical accuracy. Instead, we rely on our community members to police themselves via our tip rating system and by sending in follow-up comments to tips@searchstorage.com about a specific tip or tip author. We appreciate your help in making searchStorage a more successful and collaborative community of storage professionals.


This was first published in February 2001

Dig deeper on Data management tools

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchSolidStateStorage

SearchVirtualStorage

SearchCloudStorage

SearchDisasterRecovery

SearchDataBackup

Close