Skip to content

Instantly share code, notes, and snippets.

@gdugas
Created May 12, 2014 10:13
Show Gist options
  • Save gdugas/8f0a4e7f7fc8a7fd970d to your computer and use it in GitHub Desktop.
Save gdugas/8f0a4e7f7fc8a7fd970d to your computer and use it in GitHub Desktop.
findbot.pl per file detection
82c82
<
---
>
94,105c94,95
< my (@list);
< if (!opendir(I, "$dir")) {
< return if $! =~ /no such file/i;
< print STDERR "$dir: Can't open: $!, skipping\n";
< return;
< }
< @list = readdir(I);
< closedir(I);
< for my $mfile (@list) {
< next if $mfile =~ /^\.\.?$/; # skip . and ..
< my $cf = $currentfile = "$dir/$mfile";
<
---
> my $cf = $currentfile = $mfile = $dir;
>
108a99,100
> my $type = `$file $cf`;
>
114c106
< if ($mfile =~ /$scripts/) {
---
> if ($type =~ /text/) {
122c114
< next if -s $currentfile > 1000000 || -s $currentfile < 2000;
---
> next if -s $currentfile > 1000000;# || -s $currentfile < 2000;
126,127d117
< my $type = `$file $cf`;
<
144d133
< }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment