Hi My directory structure is something like following: List of files in /abc/dir/ 20020811 20020812 20020814 20020815 (where directory name above is the date, and daily changes i.e. directories are added and deleted) list of files in /abc/dir/20020811 toid toil etd dt (all the date directories contain the directories as above and there are many subdirectories in the aboce directories) I want to rsync all the dates directories but only the "toid" subdirectory. MY QUESTION IS: How can i rsync only the selected subdirectories? Please help in this matter... Thanks Nitin
for i in `ls .` do; rsync -e ssh ./$i/toid user@host:dir; done I had some problems with using --include and --exclude to skip different directories and include others when I had a huge number of subdirectories. It always seems like the rsync actually searches trough those exluded directories just to exclude them in stead of denying them from the beginning. Kind regards, Pepijn Palmans Managing Director Kangaroot Linux Solutions Grote Steenweg 91 2600 Berchem, Antwerpen Tel: +32 3/286.17.17 Fax: +32 3/281.23.49 Email: pepijn@kangaroot.net On Mon, 12 Aug 2002, Nitin Agarwal wrote:> Hi > My directory structure is something like following: > > List of files in /abc/dir/ > 20020811 > 20020812 > 20020814 > 20020815 > (where directory name above is the date, and daily changes i.e. > directories are added and deleted) > > list of files in /abc/dir/20020811 > toid > toil > etd > dt > (all the date directories contain the directories as above and there are > many subdirectories in the aboce directories) > I want to rsync all the dates directories but only the "toid" > subdirectory. > > MY QUESTION IS: How can i rsync only the selected subdirectories? > > Please help in this matter... > > Thanks > Nitin > > -- > To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html >
On Mon, 12 Aug 2002, Nitin Agarwal wrote:> I want to rsync all the dates directories but only the "toid" > subdirectory.The easiest thing to do might be to use the -R (--relative) option, like this: rsync -avR /abc/dir/*/toid host:/dest/ This will create the /abc/dir/DATE/toid dirs on the destination side. If the "/dest/" dir begins with "/abc/dir", that part will be skipped. If you don't like the extra subdirs, use an include file like this: + /*/toid - /*/* and a command like this: rsync -avR --include-from=above-file /abc/dir/ host:/dest/ This includes everything in the base dir (by default), and only the toid dirs in the one-level-deep subdirs. All other files are unaffected. So, if the date dirs aren't the only thing in the base dir, you'll need a more complicated include file, like this: + /[1-2][0-9][0-9][0-9][0-1][0-9][0-3][0-9] - /* + /*/toid - /*/* ..wayne..