#! /usr/bin/perl

$flag = shift;
$x = 0;
$xmax = 1080;
while ($x < $xmax) {
    sleep 10;
    foreach $dir ("~/UpmuReduction/sk2/upmu3ET/NQS",
                  "~/UpmuReduction/NQS",
                  "~/nuance/data/NQS",
                  "~/Thesis/src13/NQS",
                  "~/UpmuReduction/PureShower/NQS",
                  "~/official_ntuple/NQS",
                  "~/skdetsim/NQS"
                  ) {
        if($flag eq '-v') {print "$dir\n";}
        system "rm -f $dir/*.err";
        system "rm -f $dir/*.log";
    }
    $x++;
    $test = `~ethrane/bin/qlist.csh`;
    if($test == ""){$x = $xmax;}
}

print "Your NQS submissions are finished.\n"
