| 
     
       |  |  |  | 
            
              | 
             
               | 
               
                 |  | UGU: Unix Guru Universe - Unix Tip #4514- July 21, 2025
 -  Home : Help
 : Today's Tip Unix Tip #4514- July 21, 2025
 
 
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)
 |  |  
                 |  |  
                 |   Copyright 1994-2024 Unix Guru Universe 
 |  |  |  |  |