All pastes #236245 Raw Edit

Mine

public text v1 · immutable
·published 2006-11-03 18:35 UTC
rendered paste body
sub get_old_files() {
        $base_dir       = shift @_;
        $age_limit      = shift @_;
        $mtime  = 0;

        opendir(DIRHANDLE, "$base_dir");
        while ($filename = readdir(DIRHANDLE)) {
                $full_path = $base_dir . '/' . $filename;
                push(@tmp_files,$full_path);
        }
        closedir(DIRHANDLE);

        foreach (@tmp_files) {
                $full_path = $_;
                if (-d $full_path) {
                        next if ($full_path =~ /.*\.$/);
                        # Open get_old_files and return results
                        print "Spawning new function for $full_path\n";
                        @new_files = &get_old_files($full_path,$age_limit);
                        print Dumper @new_files;
                #       @files = (@files,@new_files);
                }
                else {
                        $mtime = (stat($full_path))[9];
                        if ($mtime < (time() - (86400*$age_limit))) {
                                push(@files,$full_path);
                        }
                }
        } # End while files

        unset(@tmp_files);

        return @files;

} # get_old_files