#-############################################# sub del_upl_files { #-############################################# my $usr_path = '/var/www/htdocs/usrUpl'; my $dir; local $_; opendir(UPL_DIR, $usr_path) or return; while (defined($dir = readdir UPL_DIR)) { $dir =~ /^\./ && next; opendir(USR_DIR, "$usr_path/$dir") or next; if (time - ((stat(USR_DIR))[8]) > 60) { my @files = grep /\.dat$/, readdir USR_DIR; closedir USR_DIR; unlink "$usr_path/$dir/$_" for @files; rmdir "$usr_path/$dir"; next; } closedir USR_DIR; } closedir UPL_DIR; }