equal
deleted
inserted
replaced
|
1 from __future__ import ( |
|
2 absolute_import, |
|
3 print_function, |
|
4 ) |
|
5 |
|
6 import argparse |
|
7 import os |
|
8 |
|
9 ap = argparse.ArgumentParser() |
|
10 ap.add_argument('path', nargs='+') |
|
11 opts = ap.parse_args() |
|
12 |
|
13 def gather(): |
|
14 for p in opts.path: |
|
15 if not os.path.exists(p): |
|
16 return |
|
17 if os.path.isdir(p): |
|
18 yield p + os.path.sep |
|
19 for dirpath, dirs, files in os.walk(p): |
|
20 for d in dirs: |
|
21 yield os.path.join(dirpath, d) + os.path.sep |
|
22 for f in files: |
|
23 yield os.path.join(dirpath, f) |
|
24 else: |
|
25 yield p |
|
26 |
|
27 print('\n'.join(sorted(gather()))) |