![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community. |
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| overwrite specific lines in a file | csecnarf | Shell Programming and Scripting | 7 | 05-13-2008 11:01 AM |
| how to print struct in GDB | useless79 | High Level Programming | 4 | 09-06-2007 08:02 AM |
| Overwrite & Delete in Text File | 33junaid | Shell Programming and Scripting | 11 | 08-16-2007 05:28 AM |
| overwrite problem | ali999 | UNIX for Dummies Questions & Answers | 2 | 03-24-2005 02:43 AM |
| Overwrite | Duckman | UNIX for Dummies Questions & Answers | 9 | 03-27-2001 01:27 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
|||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|