#!/usr/bin/perl use strict; sub readfile { my($fname)= @_ ; my($ret) ; local(*F, $/) ; open(F, "<$fname") || return undef ; undef $/ ; $ret= ; close(F) ; return $ret ; } my ($directory) = shift @ARGV; # my @argv; opendir( DIR, $directory) or die "couldn't open directory!\n"; chdir $directory; my (@manyproxies) = readdir(DIR); closedir DIR; foreach (@manyproxies) { my ($proxy) = $_; chomp($proxy); if($proxy =~ m/^s_/) { print "starts with s_."; chdir($proxy); my $pwd = `pwd`; chomp($pwd); opendir(DIR, $pwd); #print "changed to $pwd "; my (@files) = readdir(DIR) or print "readdir returned false.!"; #open(COMBO, combo.bin) or die "couldn't open file combo.bin.\n"; open(COMBO, ">combo.dat"); my ($filename) = "username.txt"; my ($username1) = &readfile($filename); $username1 =~ s#[^A-Za-z0-9]*##g; foreach (@files) { my ($file) = $_; if($file =~ m/.txt$/) { unless($file =~ m/^combo.txt$/) { my ($data) = &readfile($file); if ($data) { # convert inclusions: $data =~ s## &readfile("../admin/$1.atxt");#ges; $data =~ s## &readfile("../u_$username1/$1.utxt");#ges; $data =~ s## &readfile("$1.stxt");#ges; my ($lines) =1; my ($data2) =$data; $lines += ($data2 =~ tr/\n/\n/); #print "appending $lines of $file. "; print COMBO "\n\n"; print COMBO $data; } } } } closedir COMBO; chdir ('..'); } else { print "\t"; } print "\titem is currently $proxy\n"; } print "\n"; # open(F, "$fname") ; # undf $/ ; # $ret= ; # close(F) ; # # return $ret ; # # # If (1) # { # my $filename; # my $file; # # $filename = "./ada1.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # # $filename = "./ada2.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./ada3.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./adb1.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./adb2.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; ## print $file; # } ## # $filename = "./adb3.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./adrotate.txt"; # # $file = &readfile($filename); ## if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./f1.txt"; # # $file = &readfile($filename); # if ($file) # { ## print"\n\n"; # print $file; # } # # $filename = "./f2a.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./f2b.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./h1.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # $filename = "./top2.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # ## $filename = "./top.txt"; # # $file = &readfile($filename); # if ($file) # { # print"\n\n"; # print $file; # } # # chdir("../") || # die("Could not change dir"); # } # }