If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):
From: John-Paul Stewart <jpstewart@sympatico.ca>
Subject: Re: How to clone a directory structure?
References: <cc8eda1b.0212281408.2826ec45@posting.google.com> <XPrP9.486238$P31.> <cc8eda1b.0212290326.5a2bca34@posting.google.com> <3b305d66f51187b8f35a675255dd908a@remailer.privacy.at> <cc8eda1b.0301010544.6b47651f@posting.google.com>
Date: Wed, 01 Jan 2003 11:39:05 -0500
Martin Gross wrote:
>
> Anonymous <nobody@remailer.privacy.at> wrote in message news:<3b305d66f51187b8f35a675255dd908a@remailer.privacy.at>...
> > Martin Gross <mazze@writeme.com>:
> > > Need tool to create the clone structure, thanks for the idea.
> > > However, that's not the main problem. Main issue is about maintaining
> > > the clone, i.e. in case I erase a directory inside the source/parent
> > > tree, it should be deleted with the next "clone update" in the clone
> > > tree as well.
> >
> > 'rsync' is the tool for this job.
> >
> > (script with find and rsync snipped)
>
> Cool, that's really what I needed. I will first need to look into how
> performance is - for the first steps the $filelist is a 6MB file with
> some 60.000 file listings ;-) In the final application it should end
> up with somewhere around 1/3 to 1/2 of that and I am not really sure
> about the performance yet ;-) A simple argument such as --dirs-only
> would probably be better, but seems not available.
What about something like:
#!/bin/sh
# clone a directory stucture (no files copied)
# derived from a script by another poster
f=/your/source/directory
t=/your/destination/directory
dirlist=/tmp/dirs
mkdir -p $t
cd $f
# get the names of all directories and remove the initial ./
part
find . -type f | sed 's@^\./@@' > $dirlist
rsync -v -rlpogDt --delete --force --exclude-from=$dirlist
. $t
rm $dirlist
The script is untested; use it at your own risk. All I've
done is change the 'find' parameters to find and list the
directories _only_. Then I've changed the 'rsync'
parameters to include only those (rather than excluding 6MB
of filenames).
Again, this script is untested and is intended only to
demonstrate the concept.
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 1 | 3 | 11 | 217 | 1,420 |
/Bofcusm/1926.html copyright 1997-2004 (various authors) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Add your comments