#!/usr/bin/perl use vars qw(%config %category); use strict; $config{'basepath'} = '/data/web/65682/auctiondata/'; %category = ( snow => 'snow', skate => 'skate', surf => 'surf', misc => 'misc', ); sub getnumber { my $key; foreach $key (sort keys %category) { umask(000); # UNIX file permission junk mkdir("$config{'basepath'}$key", 0777) unless (-d "$config{'basepath'}$key"); opendir DIR, "$config{'basepath'}$key" or &oops("category directory $key could not be opened"); my $numfiles = scalar(grep -T, map "$config{'basepath'}$key/$_", readdir DIR); my $totalfiles =+ $numfiles; closedir DIR; } print $totalfiles; }