# subroutine to get date and time sub timecheck { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # deal with the epoch and counting from zero $year += 1900; $mon += 1; } # make the directory for the year, month, and day as needed. # Specify the directory to which you'd like to store the capture files. &timecheck; #$logfiledir = "/home/george/capfiles/".$year.'/'.$mon.'/'.$mday; $logfiledir = sprintf("/home/george/capfiles/%02d/%02d/%02d", $year, $mon, $mday); mkpath( $logfiledir, {verbose => 1} ); ########################################## #BLAH BLAH JUST TO MAKE SURE I GOT THIS... # # $capturefile = $logfiledir.'/'.$year."-".$mon."-".$mday."-".$hour."-".$min.".cap"; # would be re-written: ########################################## $capfilename = sprintf("/%02d-%02d-%02d-%02d-%02d.cap", $year, $mon, $mday, $hour, $min); $capturefile = $logfiledir.$capfilename;