Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Hunt the media, zip, and EXE files in users' home shares

by OzzyOsbourne (Chaplain)
on Aug 22, 2000 at 02:18 UTC ( [id://28931]=perlcraft: print w/replies, xml ) Need Help??

   1: use File::Find;
   2: 
   3: print "Please Enter Server name:";
   4: chomp($server=<STDIN>);
   5: $server2="//server2/e$/ #put in where you want the logs to go
   6: $dir1="//$server/e\$/users";
   7: if (!(-e "$dir1")){#if directory doesn't exist try d$
   8: 	$dir1="//$server/d\$/users";
   9: 	if (!(-e "$dir1")){
  10: 		die "Directory not does not exist on server\n...Exiting Script.\n";
  11: 	}
  12: }
  13: $out="//$server2/public/serverlogs/$server\.tmp";
  14: $out2="//$server2/public/serverlogs/media/$server\.txt";
  15: open (OUTFILE, ">$out") or die "Cannot open $out for write :$!";
  16: 	
  17: print "finding media files on $dir1\.\.\.\n";
  18: 
  19: find(\&wanted, $dir1);
  20: sub wanted {
  21: 	if (!("$File::Find::dir"=~/}/)&&(/mp3$|avi$|exe$|mpg$|wav$|zip$/i)){
  22: 		print OUTFILE "$File::Find::dir/$_\n";
  23: 		print "$File::Find::dir\n";
  24:     	}
  25: }
  26: close OUTFILE;
  27: open (OUTFILE, "$out") or die "Can't open";
  28: open (OUTFILE2, ">$out2") or die "Can't open";
  29: @input=<OUTFILE>;
  30: foreach (@input){
  31: 	s/\//\\/g;
  32: 	print OUTFILE2 "$_";
  33: 	
  34: }
  35: close OUTFILE;
  36: close OUTFILE2;
  37: unlink $out;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found