Skip to content

Instantly share code, notes, and snippets.

@ken1flan
Created May 6, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ken1flan/218ddbcc4b39e0b47773 to your computer and use it in GitHub Desktop.
Save ken1flan/218ddbcc4b39e0b47773 to your computer and use it in GitHub Desktop.
ブラックリストに含まれる拡張子のファイルを検知
#!/usr/bin/perl
@blacklist = qw(pl conf pm);
$filelist_str = <<EOF;
aaa/bbb/test.jpg
aaa/bbb/test.png
aaa/bbb/test.pl
aaa/bbb/test.pm
aaa/bbb/test.conf
aaa/bbb/test.jpg
EOF
@filelist = split("\n", $filelist_str);
foreach $filename (@filelist) {
if ($filename =~ /.*\.(.*)$/) {
$ext = $1;
if ( grep { $_ eq $ext } @blacklist) {
print("$filename found\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment