Mini Shell
Direktori : /opt/sharedrads/ |
|
Current File : //opt/sharedrads/find_warez |
#!/usr/local/bin/perl
#
# Written by Brandon Florin (7/4/2009)
@var = `locate *.iso *.dmg *.tar *.avi *.mpg *.rar *.zip | sed -e 's/^/\"/;' | sed -e 's/\$/\"/;' | xargs ls -al`;
%rows = "";
foreach (@var) {
chomp ($_);
#my (undef, undef, $user, undef, $size, undef, undef, undef, $file) = split(/\s+/, $_);
my ($user, $size, $file) = $_ =~ /^.*?\s+.*?\s+(.*?)\s+.*?\s+(.*?)\s+.*?\s+.*?\s+.*?\s+(.*?)$/;
chomp($user); chomp($size); chomp($file);
if ($size > "100000000") { $rows{$size}{$user}{$file} += 1; }
}
$email = "";
$check = "";
$email .= "#===========================+\n#| Size | User | Location |\n#+===========================+\n";
for my $size ( sort {$b<=>$a} keys %rows) {
my $count = "";
my $origsize = $size;
my $checksize = $size;
until ($checksize < '100') {
$checksize /= 1024;
$count += 1;
}
my ($newsize,undef) = split(/\./, $origsize);
if ($newsize =~ /\d{13}/) { $newsize =~ s/\d{11}$//; $newsize =~ s/(\d)$/.$1/; $newsize =~ s/$/ TB/; }
if ($newsize =~ /\d{10}/) { $newsize =~ s/\d{8}$//; $newsize =~ s/(\d)$/.$1/; $newsize =~ s/$/ GB/; }
if ($newsize =~ /\d{7}/) { $newsize =~ s/\d{5}$//; $newsize =~ s/(\d)$/.$1/; $newsize =~ s/$/ MB/; }
$email .= "$newsize\t";
for my $user( keys %{%rows->{ $size }} ) {
$email .= "$user\t";
for my $file ( keys %{%rows->{ $size }->{ $user}} ) {
$email .= "$file\n";
}
}
}
$email =~ s/^\t//; $email =~ s/\t$//;
print $email;
Zerion Mini Shell 1.0