]> arthur.barton.de Git - bup.git/blobdiff - cmd/drecurse-cmd.py
README.md: mention workaround for pwd test issue
[bup.git] / cmd / drecurse-cmd.py
index 218b2ef077fee395809e8a3ff96f2d729e9fa9c3..cdf66803034bd0f429a869ea75b94ba06f29e25a 100755 (executable)
@@ -1,4 +1,6 @@
 #!/usr/bin/env python
+
+from os.path import relpath
 from bup import options, drecurse
 from bup.helpers import *
 
@@ -8,6 +10,8 @@ bup drecurse <path>
 x,xdev,one-file-system   don't cross filesystem boundaries
 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)
+exclude-rx= skip paths matching the unanchored regex (may be repeated)
+exclude-rx-from= skip --exclude-rx patterns in file (may be repeated)
 q,quiet  don't actually print filenames
 profile  run under the python profiler
 """
@@ -17,9 +21,14 @@ o = options.Options(optspec)
 if len(extra) != 1:
     o.fatal("exactly one filename expected")
 
+drecurse_top = extra[0]
 excluded_paths = parse_excludes(flags, o.fatal)
-
-it = drecurse.recursive_dirlist(extra, opt.xdev, excluded_paths=excluded_paths)
+if not drecurse_top.startswith('/'):
+    excluded_paths = [relpath(x) for x in excluded_paths]
+exclude_rxs = parse_rx_excludes(flags, o.fatal)
+it = drecurse.recursive_dirlist([drecurse_top], opt.xdev,
+                                excluded_paths=excluded_paths,
+                                exclude_rxs=exclude_rxs)
 if opt.profile:
     import cProfile
     def do_it():