Add Apps.AppListSearchQueryLength UMA histogram.
[chromium-blink-merge.git] / build / android / gyp / find.py
bloba9f1d49855674f15b9a846e6c850cd28160eda3b
1 #!/usr/bin/env python
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 """Finds files in directories.
8 """
10 import fnmatch
11 import optparse
12 import os
13 import sys
16 def main(argv):
17 parser = optparse.OptionParser()
18 parser.add_option('--pattern', default='*', help='File pattern to match.')
19 options, directories = parser.parse_args(argv)
21 for d in directories:
22 if not os.path.exists(d):
23 print >> sys.stderr, '%s does not exist' % d
24 return 1
25 for root, _, filenames in os.walk(d):
26 for f in fnmatch.filter(filenames, options.pattern):
27 print os.path.join(root, f)
29 if __name__ == '__main__':
30 sys.exit(main(sys.argv[1:]))