Created
May 6, 2015 13:09
-
-
Save ken1flan/218ddbcc4b39e0b47773 to your computer and use it in GitHub Desktop.
ブラックリストに含まれる拡張子のファイルを検知
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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