# SYNOPSIS
-bup drecurse [-x] [-q] [--profile] \<path\>
+bup drecurse [-x] [-q] [--exclude *path*]
+[--exclude-from *filename*] [--profile] \<path\>
# DESCRIPTION
-q, --quiet
: don't print filenames as they are encountered. Useful
when testing performance of the traversal algorithms.
+
+--exclude=*path*
+: a path to exclude from the backup (can be used more
+ than once)
+
+--exclude-from=*filename*
+: a file that contains exclude paths (can be used more
+ than once)
--profile
: print profiling information upon completion. Useful
# SYNOPSIS
bup index <-p|-m|-u> [-s] [-H] [-l] [-x] [--fake-valid]
-[--check] [-f *indexfile*] [--exclude *path*] [--exclude-file *filename*] [-v] <filenames...>
+[--check] [-f *indexfile*] [--exclude *path*]
+[--exclude-from *filename*] [-v] <filenames...>
# DESCRIPTION
: a path to exclude from the backup (can be used more
than once)
---exclude-file=*filename*
-: a file that contains exclude paths
+--exclude-from=*filename*
+: a file that contains exclude paths (can be used more
+ than once)
-v, --verbose
: increase log output during update (can be used more
bup drecurse <path>
--
x,xdev,one-file-system don't cross filesystem boundaries
-exclude= a comma-seperated list of paths to exclude from the backup
+exclude= a path to exclude from the backup (can be used more than once)
+exclude-from= a file that contains exclude paths (can be used more than once)
q,quiet don't actually print filenames
profile run under the python profiler
"""
if len(extra) != 1:
o.fatal("exactly one filename expected")
-if opt.exclude:
- excluded_paths = [realpath(x) for x in opt.exclude.split(",")]
-else:
- excluded_paths = None
+excluded_paths = drecurse.parse_excludes(flags)
it = drecurse.recursive_dirlist(extra, opt.xdev, excluded_paths)
if opt.profile:
check carefully check index file integrity
f,indexfile= the name of the index file (normally BUP_DIR/bupindex)
exclude= a path to exclude from the backup (can be used more than once)
-exclude-file= a file that contains exclude paths
+exclude-from= a file that contains exclude paths (can be used more than once)
v,verbose increase log output (can be used more than once)
"""
o = options.Options('bup index', optspec)
log('check: starting initial check.\n')
check_index(index.Reader(indexfile))
-excluded_paths = []
-
-if opt.exclude:
- for flag in flags:
- (option, parameter) = flag
- if option == '--exclude':
- excluded_paths.append(realpath(parameter))
-
-if opt.exclude_file:
- try:
- f = open(realpath(opt.exclude_file))
- for exclude_path in f.readlines():
- excluded_paths.append(realpath(exclude_path.strip()))
- except Error, e:
- log("index: warning: couldn't read %s" % opt.exclude_file)
- finally:
- f.close()
-
+excluded_paths = drecurse.parse_excludes(flags)
paths = index.reduce_paths(extra)
except:
pass
raise
+
+def parse_excludes(flags):
+ excluded_paths = []
+
+ for flag in flags:
+ (option, parameter) = flag
+ if option == '--exclude':
+ excluded_paths.append(realpath(parameter))
+
+ if option == '--exclude-from':
+ try:
+ f = open(realpath(parameter))
+ for exclude_path in f.readlines():
+ excluded_paths.append(realpath(exclude_path.strip()))
+ except Error, e:
+ log("warning: couldn't read %s" % parameter)
+ finally:
+ f.close()
+
+ return excluded_paths
+
b
f"
-WVSTART "exclude-file"
-D=exclude-filedir.tmp
-EXCLUDE_FILE=exclude-file.tmp
+WVSTART "exclude-from"
+D=exclude-fromdir.tmp
+EXCLUDE_FILE=exclude-from.tmp
echo "$D/d
$TOP/$D/g
$D/h" > $EXCLUDE_FILE
mkdir $D/d $D/d/e
WVPASS bup random 512 >$D/f
mkdir $D/g $D/h
-WVPASS bup index -ux --exclude-file $EXCLUDE_FILE $D
-bup save -n exclude-file $D
-WVPASSEQ "$(bup ls exclude-file/latest/$TOP/$D/)" "a
+WVPASS bup index -ux --exclude-from $EXCLUDE_FILE $D
+bup save -n exclude-from $D
+WVPASSEQ "$(bup ls exclude-from/latest/$TOP/$D/)" "a
b
f"
+rm $EXCLUDE_FILE