Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: rsync and [0-9]

  • Subject: Re: rsync and [0-9]
  • From: Tim Smith <reply_in_group@xxxxxxxxxxxxxxxx>
  • Date: Thu, 12 Oct 2006 17:01:15 -0700
  • Newsgroups: comp.os.linux.advocacy
  • Organization: Posted via Supernews, http://www.supernews.com
  • References: <1160687866.234253.316810@m7g2000cwm.googlegroups.com>
  • User-agent: MT-NewsWatcher/3.5.1 (Intel Mac OS X)
  • Xref: news.mcc.ac.uk comp.os.linux.advocacy:1167311
In article <1160687866.234253.316810@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
 "amit" <amit.kohan@xxxxxxxxx> wrote:
> Hello Group,
> 
> 
> How can I make rsync in this command?
> 
> rsync -z -perms --progress --stats -b --backup-dir=/Thursday -a -r
> /usr/local/ldb/db/[0-9]/aDir
> /root/backups/Thursday/ldb/db/[0-9]/aDir
> 
> 
> where [0-9] stands for directories with numeric names.

I'm assuming that the numeric names can be more than one character.  I 
haven't used --backup-dir, and upon first reading of the man page, it 
confuses the heck out of me, and when I tried to figure it out 
experimentally--it didn't seem to do anything.  So, keeping in mind that 
what follows may be totally off because I don't know what your command 
is actually trying to do, here's a general outline.

(cd /usr/local/ldb/db; ls) | grep '^[0-9][0-9]*$' | while read name
do
   if [ -d /usr/local/ldb/db/$name ]
   then
      SRC=/usr/local/ldb/db/$name/aDir
      DST=/root/backups/Thursday/ldb/db/$name/aDir
      rsync [your options] $SRC $DST
   fi
done

-- 
--Tim Smith

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index