[clug] rsync -r --max-depth=2

Michael James clug3 at james.st
Fri Aug 31 06:00:19 GMT 2007

I need to pull a mirror of the home dirs on an rsync server.
Because it's a huge job I normally run a script
 that does an rsync for each user.

When it happens locally the script starts like this:
cd /home
for $dir in `ls -1 */*`
	test -d "/back/$dir" || mkdir /back/$dir
	rsync  -a   /home/${dir}/   /back/${dir}/

From a remote rsync server I can't do shell globbing.
So if a new user is added , the mirror will never get to know about it.

Is there any option on rsync that will accomplish this:

rsync -ra --maxdepth=2 server::home/ /mirror/
cd /mirror
for $dir in `ls -1 */*`
	rsync -a  server::home/${dir}/   /back/${dir}/

<Wonders>  Can  "-d"  be encoraged to pull an unnamed dir?


Konqueror has gotten so clever for its own boots
  that it has forgotten what a web browser is for.

More information about the linux mailing list