use strict; use warnings; my $dir = "/whatever"; my $time = time(); my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time); my $btime = $time - $wday * 86400 - $hour * 3600 - $min * 60 - $sec; if (!-e "$dir/$btime.mrk") { # process all records timestamped ($btime - 604799) to $btime # create file "$dir/$btime.mrk" }