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 last published in February 2001

Dig Deeper on Data management tools

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchSolidStateStorage

SearchConvergedInfrastructure

SearchCloudStorage

SearchDisasterRecovery

SearchDataBackup

Close