include/exclude: I miss the point

Michal Soltys soltys at ziu.info
Fri Sep 10 16:43:49 MDT 2010


On 10-09-10 21:13, Hans Troost wrote:
>
> So my exclude-files contains:
> .*
>
> the include file contains:
> .kde4/share/apps/kabc/distlists
> .kde4/share/apps/kabc/std.vcf
>
>
> Result:
> 1. Success: 2 .kde4/share/apps/kabc-files

Are you sure about that part ? '.*' ('H, .*' as seen by sending rsync) 
should short-circuit any .kde/ directory subtree and exclude it from 
file list/transfer. You would need something more elaborate to get just 
those two fles from .kde4 and nothing else.

Anyway, putting that detail aside and if I'm reading things right.

Your rules (combined) look like:

+, .mozilla/
+, .mozilla/firefox/
+, .mozilla/firefox/plp6wzjm.default/
+, .mozilla/firefox/plp6wzjm.default/bookmarkbackups/*
+, .mybackup

H, .*
H, .mybackup/backup.log.*
H, .mozilla/extensions
H, *.*~
H, Desktop
H, Downloads
H, Movies
H, Music
H, Picturestmp
H, Videos

+, * (implicit final rule)

H - because you added --delete-excluded, so receiving side will not 
protect them from deletion.

For receiving rsync that means just:
R, * (as "consider everything not part of the transfer a candidate to 
delete")

For sending rsync:
S, .mozilla/
S, .mozilla/firefox/
S, .mozilla/firefox/plp6wzjm.default/
S, .mozilla/firefox/plp6wzjm.default/bookmarkbackups/*
S, .mybackup

H, .* <- this makes following 2 rules redundant
H, .mybackup/backup.log.*
H, .mozilla/extensions
H, *.*~
H, Desktop
H, Downloads
H, Movies
H, Music
H, Picturestmp
H, Videos

S, * (implicit final rule)

Which does exactly what you experienced:

> 3. Failure: I have all other files, sub-dirs and their content as well in
> .mozilla/firefox/plp6wzjm.default.

They were all caught by the final implicit include, and none of them 
matched your H (exclude) rules.

> 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.

Being part of exclude rules, they will be catched and excluded from 
transfer, but the rest will not.

Note, that nothing from .mybackup that matches H (exclude) rules will be 
backed up.

>
> 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).

Hmm, you should get

.mozilla/firefox/plp6wzjm.default/bookmarkbackups/*
.mybackup/

backed up. Otherwise the rest will be hidden from transfer (to be 
precise, any file/directory starting with a letter or .).


More information about the rsync mailing list