darshan-mk-log-dirs.pl.in 833 Bytes
Newer Older
1
#!/usr/bin/perl -w
2 3 4 5 6
#
#  (C) 2009 by Argonne National Laboratory.
#      See COPYRIGHT in top-level directory.
#

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
use File::Basename;

# creates a hierarchy of subdirectories for darshan to place log files in
# LOGDIR/<year>/<month>/<day>/

# use log dir specified at configure time
$LOGDIR = "@__CP_LOG_PATH@";


my $year = (localtime)[5] + 1900;
my $month;
my $day;
my $i;
my $j;
my $k;

umask(0);

# go through the end of next year
for ($i=$year; $i<($year+2); $i++)
{
    mkdir("$LOGDIR/$i", 0755) or die("Error: could not mkdir $LOGDIR/$i.\n");
    for ($j=1; $j<13; $j++)
    {
        mkdir("$LOGDIR/$i/$j", 0755) or die("Error: could not mkdir $LOGDIR/$i/$j.\n");
        for ($k=1; $k<32; $k++)
        {
            mkdir("$LOGDIR/$i/$j/$k", 01777) or die("Error: could not mkdir $LOGDIR/$i/$j/$k.\n");

        }
    }
}