ajy has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; my $dir = "*****"; my $directory_count = 0; my $file_count=0; opendir(DIR, $dir); LINE: while(my $FILE = readdir(DIR)) { next LINE if($FILE =~ /^\.\.?/); if(-d $FILE){ $directory_count++; } else { $file_count++; } } closedir(DIR); print "Directories: $directory_count\n"; print "Files: $file_count\n"; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To count number of files created yesterday in a directory ( file find yesterday)
by beech (Parson) on Feb 03, 2017 at 03:18 UTC | |
|
Re: To count number of files created yesterday in a directory
by haukex (Archbishop) on Feb 03, 2017 at 07:41 UTC | |
|
Re: To count number of files created yesterday in a directory
by Marshall (Canon) on Feb 03, 2017 at 17:40 UTC | |
|
Re: To count number of files created yesterday in a directory
by Cristoforo (Curate) on Feb 04, 2017 at 00:31 UTC | |
by hippo (Archbishop) on Feb 04, 2017 at 11:18 UTC | |
by haukex (Archbishop) on Feb 04, 2017 at 13:13 UTC |