lief has asked for the wisdom of the Perl Monks concerning the following question:
#!/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 di +rectory $key could not be opened"); my $numfiles = scalar(grep -T, map "$config{'basepath'}$key/ +$_", readdir DIR); my $totalfiles =+ $numfiles; closedir DIR; } print $totalfiles; }
Edit Masem 2001-10-02 - Code tags and html-special-char edits
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: unix file permissions? or perhaps something that will make me look silly...
by VSarkiss (Monsignor) on Oct 02, 2001 at 20:48 UTC | |
|
Re: unix file permissions? or perhaps something that will make me look silly...
by suaveant (Parson) on Oct 02, 2001 at 20:47 UTC | |
|
Re: unix file permissions? or perhaps something that will make me look silly...
by Fletch (Bishop) on Oct 02, 2001 at 22:17 UTC |