| 
       
       
             | 
              | 
            
            
            
              
             
             
               
               
               
                  | 
                 
UGU: Unix Guru Universe - Unix Tip #4086- April 19, 2012
 -  Home : Help
 : Today's Tip
 Unix Tip #4086- April 19, 2012
 
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
 4085
 - DID IT REBOOT?
 4084
 - TERMINAL RESET
 4083
 - RENICE CPU HOGS
 4082
 - NICE NOT SO NICE
 4081
 - 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    | 
                
                
                | 
              
              
              | 
              | 
            
            
           
             |