include/exclude: I miss the point

Hans Troost hans.troost at gmail.com
Fri Sep 10 13:13:06 MDT 2010


Hi all,

I thought I understand how include/exclude and their precedences work (I 
read the user guide about this), but I seem to miss something.

I have 2 questions about this, separated by ======

Question 1:
--------------
I want to exclude the "hidden" directories except some sub-dirs or files: 
.mybackup and its files) and the mozilla firefox bookmarks folder and its 
contents (.mozilla/firefox/plp6wzjm.default/bookmarkbackups/*)

So my exclude-files contains:
.*
.mybackup/backup.log.*
.mozilla/extensions
*.*~
Desktop
Downloads
Movies
Music
Picturestmp
Videos

the include file contains:
.kde4/share/apps/kabc/distlists
.kde4/share/apps/kabc/std.vcf
.mozilla/
.mozilla/firefox/
.mozilla/firefox/plp6wzjm.default/
.mozilla/firefox/plp6wzjm.default/bookmarkbackups/*
.mybackup


Result:
1. Success: with both the .mybackup and the 2 .kde4/share/apps/kabc-files
2. Success: indeed I have my bookmarks in the ../bookmarkbackups/ folder
3. Failure: I have all other files, sub-dirs and their content as well in 
.mozilla/firefox/plp6wzjm.default.
4. when adding 
  .mozilla/firefox/plp6wzjm.default/Cache
  .mozilla/firefox/plp6wzjm.default/chrome
  .mozilla/firefox/plp6wzjm.default/extensions
  .mozilla/firefox/plp6wzjm.default/firebug
  .mozilla/firefox/plp6wzjm.default/OfflineCache
 to the exclude file this folders are not in, but the "normal" 
.mozilla/firefox/plp6wzjm.default/ files are.

Question: it seems that I miss the point how to do this. can you please 
give a hint about what I ḿ doing wrong?

rsync command )some date-time variable for files, but that is working):

rsync -axhhX --no-perms --omit-dir-times\
 --backup --backup-dir=$NiceDate/updated --suffix=.$Now\
 --delete --delete-excluded\
 --backup-dir-dels=$NiceDate/deleted --suffix-dels=.`date +%H%M`\
 --log-file=/home/hans/.mybackup/backup.log.$RawDate-$Now\
 --include-from=/home/hans/.mybackup/include.txt\
 --exclude-from=/home/hans/.mybackup/exclude.txt\
   /home/hans /mnt/backup

=======================================
2nd, similar question:

to play around with this stuff I wanted to test with the hidden files only 
(.*), so I tried to add all non-hidden directories and normal files to this 
exclude-test.txt, but did not get it working (it worked too much):

exclude-test.txt
.*
.mybackup/backup.log.*
[a-z]*
[A-Z]*

while my include-test is:
.kde4/share/apps/kabc/distlists
.kde4/share/apps/kabc/std.vcf
.mozilla/
.mozilla/firefox/
.mozilla/firefox/plp6wzjm.default/
.mozilla/firefox/plp6wzjm.default/bookmarkbackups/*
.mybackup

In this case I don't get any files backed up (dry-run, so checked in log-file 
only).
same rsync command (other log-file and destination)
===============
Thanks for any help,

regards,

Hans Troost




More information about the rsync mailing list