]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
New: Add param addfolder= to allow to pass a high number of files (100 000+).
authoreldy <>
Thu, 17 Jan 2013 19:54:15 +0000 (19:54 +0000)
committereldy <>
Thu, 17 Jan 2013 19:54:15 +0000 (19:54 +0000)
tools/logresolvemerge.pl

index 01dce5a9edc357ef426e99f261cb697a7e84e10d..61fb7f30067b5cce9c1ebc9c2f364b346b9c48f8 100644 (file)
@@ -103,6 +103,26 @@ my $bzcat_file = '\.bz2$';
 # Functions
 #-----------------------------------------------------------------------------
 
+#------------------------------------------------------------------------------
+# Function:            Add all files of a specific directory
+# Parameters:  $message
+# Input:               Directory path
+# Output:              None
+# Return:              Array with list of files
+#------------------------------------------------------------------------------
+sub addDirectory {
+    my ($dir,@list) = @_;
+    my $dirH;
+    opendir($dirH, $dir) || die ("Can't open '$dir'");
+    while ($_ = readdir($dirH) ) {
+               if (-f "$dir/$_") {
+                   push @list, "$dir/$_";
+               }
+    }
+    closedir($dirH);
+    return @list;
+}
+
 #------------------------------------------------------------------------------
 # Function:            Write an error message and exit
 # Parameters:  $message
@@ -274,6 +294,9 @@ for (0..@ARGV-1) {
                elsif ($ARGV[$_] =~ /ignoremissing/i) { $IgnoreMissing=1; }
                else { print "Unknown argument $ARGV[$_] ignored\n"; }
        }
+       elsif ($ARGV[$_] =~ /addfolder=(.*)$/i) {
+               @ParamFile = addDirectory($1, @ParamFile);
+       }
        else {
                push @ParamFile, $ARGV[$_];
                $cpt++;
@@ -316,6 +339,7 @@ if (scalar @ParamFile == 0) {
        print "  $PROG.$Extension [options] file\n";
        print "  $PROG.$Extension [options] file1 ... filen\n";
        print "  $PROG.$Extension [options] *.*\n";
+       print "  $PROG.$Extension [options] addfolder=dirname\n";
        print "  perl $PROG.$Extension [options] *.* > newfile\n";
        print "Options:\n";
        print "  -dnslookup      make a reverse DNS lookup on IP adresses\n";