#!/usr/bin/perl use strict; use warnings; my $dir = "."; my $directory_count = 0; my $file_count=0; my $changed_yesterday_count=0; opendir(DIR, $dir) or die "unable to open $dir"; while(my $FILE = readdir(DIR)) { next if($FILE =~ /^\.$|^\.\.$/); # .file_name is "hidden" file # . and .. are standard directories if(-d "$dir/$FILE") #need to use a full path { $directory_count++; } elsif (-f _) #simple file (not link,pipe,etc) { $file_count++; } if (-C _ == 1) # inode changed one day ago { # see notes below, this is # not perfect $changed_yesterday_count++; } } closedir(DIR); print "Directories: $directory_count\n"; print "Files: $file_count\n"; print "Dirs/files changed 1 day ago: $changed_yesterday_count\n"; __END__ example print: Directories: 5 Files: 368 Dirs/files changed 1 day ago: 0