#!/usr/bin/perl use strict; use warnings; my $dirname = "/mydir"; opendir ( DIR, $dirname ) || die "Error in opening dir $dirname\n"; my $count; while ( (my $filename = readdir(DIR)) ) { next if $filename =~ /^\.{1,2}$/; # skip . and .. $count++; } closedir(DIR); print "$count files live in '$dirname'\n";
Update: a sample mail sending code.
Have a nice day, j
In reply to Re: count files in a directory
by reisinge
in thread count files in a directory
by mahesnkl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |