OLD | NEW |
| (Empty) |
1 #!/usr/bin/python | |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Recursively list files of the target directory. Ignores dot files.""" | |
7 | |
8 import argparse | |
9 import os | |
10 import sys | |
11 | |
12 def main(target_directory): | |
13 for root, dirs, files in os.walk(target_directory): | |
14 files = [f for f in files if not f[0] == '.'] | |
15 dirs[:] = [d for d in dirs if not d[0] == '.'] | |
16 for f in files: | |
17 path = os.path.join(root, f) | |
18 print path | |
19 | |
20 if __name__ == '__main__': | |
21 parser = argparse.ArgumentParser( | |
22 description="Recursively list files of the target directory") | |
23 parser.add_argument("--target-directory", | |
24 dest="target_directory", | |
25 metavar="<target-directory>", | |
26 type=str, | |
27 required=True, | |
28 help="The target directory") | |
29 | |
30 args = parser.parse_args() | |
31 sys.exit(main(args.target_directory)) | |
OLD | NEW |