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