Merge branch 'master' of https://Governor-Tarkin@bitbucket.org/Governor-Tarkin/swg...
[swg-src.git] / tools / find_extension_in_files.pl
blobd28b730f1f41e044ca85c0cf994b140108ca4cc8
1 $dir = shift @ARGV;
2 $lookIn = shift @ARGV;
3 $lookFor = shift @ARGV;
4 die "usage: directory extension_to_look_within extension_to_look_for\n" if (!defined($lookFor));
6 sub dodir
8 local($dir) = @_;
10 opendir(DIR, $dir) || die "opendir failed";
11 local(@dir) = readdir(DIR);
12 closedir(DIR);
14 foreach (@dir)
16 next if ($_ eq '.');
17 next if ($_ eq '..');
18 local($path) = $dir . '/' . $_;
20 if (-d $path)
22 &dodir($path);
24 else
26 push(@files, $path) if (/\.$lookIn$/)
30 &dodir($dir);
32 foreach $file (sort @files)
34 open(STRINGS, 'strings ' . $file . ' |');
35 while (<STRINGS>)
37 chomp;
38 print $file . "\t" . $_ . "\n" if (/\.$lookFor$/);