Best of the Newsgroups: rsync


What is this stuff?

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


Hate these ads?



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)

Or use any RSS reader

Delivered by FeedBurner

cartoon
Need eyes on the ground at your customer's site?
Installation and light training Boston and New England
Reliable and experienced, punctual and professional.


Views for this page
Today This Week This Month This Year  Overall
1311217 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.

Publishing your articles here

More:
       - Newsgroup




Unix/Linux Consultants

Your ad here - $48.00 yearly!

http://www.breakthru.com.au SCO (Openserver and Unixware), Unix, Solaris and Linux Consulting services including: Secure Networking Solutions; Linux based Firewalls; Backup Solutions; Secure Home to Office Network Setup; Phone, Remote and On-Site Support available - Satisfaction Guaranteed!


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.


larryi@ccamedical.com SCO OS5, Debian Linux, RedHat Linux, MySQL, Apache, AJAX development using dXport/dL4/Unibasic, Windows Connectivity, Sharing Resouces, Automation, Shell Scripting



Twitter
  • Nov 18 20:41
    I'll be out all day Wednesday the 19th, hard to reach even by phone. Leave a message and have patience.
  • Nov 18 10:07
    What am I doing? Not doing what I WANT to be doing! Oh, well, in every life a little work must fall..









Change Congress


Related Posts