![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| overwrite specific lines in a file | csecnarf | Shell Programming and Scripting | 7 | 05-13-2008 08:01 AM |
| how to print struct in GDB | useless79 | High Level Programming | 4 | 09-06-2007 05:02 AM |
| Overwrite & Delete in Text File | 33junaid | Shell Programming and Scripting | 11 | 08-16-2007 02:28 AM |
| overwrite problem | ali999 | UNIX for Dummies Questions & Answers | 2 | 03-23-2005 10:43 PM |
| Overwrite | Duckman | UNIX for Dummies Questions & Answers | 9 | 03-26-2001 10:27 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
a script to clone a dir tree, & overwrite the dir struct elsewhere?
hi all,
i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to a NEW OR EXISTING specified dir target, creating dirs/subdirs as necessary (4) all ORIG dir ownership/perms should be preserved/corrected in the target tree any obvious/existing solutions? i'd have thought this exists already somewhere ... thx! richard |
| Forum Sponsor | ||
|
|
|
||||
|
Check out this post - Copying a Directory Structure to a new structure
|
|
|||
|
Hi Richard,
The tar command can be used to reproduce a directory tree with all the ownership and permissions preserved (though arbitary preserved ownership is only possible if you untar as root). By combining with the find and xargs command it is possible to tar a directory tree with none of the files in it saved. To make the compacted tree, use this command from the directory root you want to copy the tree from... find . -type d -print0 | xargs -0 tar -f tree.tgz --no-recursion -zpc This creates a file called tree.tgz. Copy this file to the directory you want to copy the tree to then just type... tar zxf tree.tgz I recommend testing this in an empty directory before letting it loose on a source tree just to make sure it creates the tree in the way you expect e.g. at the right directory level. |
|||
| Google The UNIX and Linux Forums |