]> arthur.barton.de Git - bup.git/blob - cmd/drecurse-cmd.py
Move cmd-*.py to cmd/*-cmd.py.
[bup.git] / cmd / drecurse-cmd.py
1 #!/usr/bin/env python
2 from bup import options, drecurse
3 from bup.helpers import *
4
5 optspec = """
6 bup drecurse <path>
7 --
8 x,xdev,one-file-system   don't cross filesystem boundaries
9 q,quiet  don't actually print filenames
10 profile  run under the python profiler
11 """
12 o = options.Options('bup drecurse', optspec)
13 (opt, flags, extra) = o.parse(sys.argv[1:])
14
15 if len(extra) != 1:
16     o.fatal("exactly one filename expected")
17
18 it = drecurse.recursive_dirlist(extra, opt.xdev)
19 if opt.profile:
20     import cProfile
21     def do_it():
22         for i in it:
23             pass
24     cProfile.run('do_it()')
25 else:
26     if opt.quiet:
27         for i in it:
28             pass
29     else:
30         for (name,st) in it:
31             print name
32
33 if saved_errors:
34     log('WARNING: %d errors encountered.\n' % len(saved_errors))
35     sys.exit(1)