From 62f3faef86b6e2e7f32b12b14d7cf637a3c36eba Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Tue, 2 Feb 2010 00:54:10 -0500 Subject: [PATCH] cmd-save: add --smaller option. This makes it only back up files smaller than the given size. bup can handle big files, but you might want to do quicker incremental backups and skip bigger files except once a day, or something. It's also handy for testing. --- cmd-save.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd-save.py b/cmd-save.py index 8c7ec9e..429d646 100755 --- a/cmd-save.py +++ b/cmd-save.py @@ -18,6 +18,7 @@ t,tree output a tree id c,commit output a commit id n,name= name of backup set to update (if any) v,verbose increase log output (can be used more than once) +smaller= only back up files smaller than n bytes """ o = options.Options('bup save', optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) @@ -108,6 +109,8 @@ for (transname,ent) in index.Reader(git.repo('bupindex')).filter(extra): mode = '%o' % ent.mode id = ent.sha shalists[-1].append((mode, file, id)) + elif opt.smaller and ent.size >= opt.smaller: + add_error('skipping large file "%s"' % ent.name) else: try: if stat.S_ISREG(ent.mode): -- 2.39.5