1#!/usr/bin/perl -w 2# Copyright 2013 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# Use: find_files.pl <start-from> [exclude-dir ...] 7 8use strict; 9use warnings; 10use File::Basename; 11 12my $progname = basename($0); 13 14my $root_dir = shift @ARGV; 15my @find_args = (); 16while (@ARGV) { 17 my $path = shift @ARGV; 18 push @find_args, qw'-not ( -path', "*/$path/*", qw'-prune )' 19} 20push @find_args, qw(-follow -type f -print); 21 22open FIND, '-|', 'find', $root_dir, @find_args 23 or die "$progname: Couldn't exec find: $!\n"; 24my $check_regex = '\.(asm|c(c|pp|xx)?|h(h|pp|xx)?|p(l|m)|xs|sh|php|py(|x)' . 25 '|rb|idl|java|el|sc(i|e)|cs|pas|inc|js|pac|html|dtd|xsl|mod|mm?' . 26 '|tex|mli?)$'; 27my @files = (); 28while (<FIND>) { 29 chomp; 30 print "$_\n" unless (-z $_ || !m%$check_regex%); 31} 32close FIND; 33