Unix Tip #4514- July 21, 2023


SEARCH : Home : Help : Today's Tip

RECREATING DIRECTORY TREES


This problem frequently
occurs. There is a machine
with a complex directory
structure, and you want to
have a copy of this directory
tree on another machine.

It is for testing purposes
(for example), and you want
to copy permissions,
UID/GID, and the directory
tree but don't want to copy
user files.

Here is the fastest
solution:
machine_a # cd /mydir
machine_a # find . -depth -print | cpio -o -O /tmp/dir.cpio

Copy the dir.cpio to
another machine.

machine_b # mkdir /mydir ; cd /mydir
machine_b # cat /tmp/dir.cpio | cpio -id


This tip generously supported by: paul@dataware.hu


NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted by various unix admins around the globe. UGU suggest you read and test each tip in a non-volitile environment before placing into production.


LAST 5 TIPS
4513 - DID IT REBOOT?
4512 - TERMINAL RESET
4511 - RENICE CPU HOGS
4510 - NICE NOT SO NICE
4509 - STAT FOR THE INODE


I want to SUBSCRIBE and get a UGU Tip everyday.
I want to UNSUBSCRIBE and NOT get a UGU Tip everyday.

If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
Email Address:

Yes, email me a Hot Unix Tip everday.

Enter Hot Unix Tip (optional):

Yes, I will support this tip

Captcha (not case sensitive):


Please enter the above letters:


HOME | Flavors | Admin | Network | Security | S/W | Help | Events | Vendors | Careers | Internet
About | Add Link | Feedback | Search

Copyright © 1994-2005 Unix Guru Universe