gnu@perl has asked for the wisdom of the Perl Monks concerning the following question:
I tried posting this to SoPW once and received a response, for which I am grateful, but the question never appeared on SoPW so I am trying again.
I am writing a program to maintain log files. I know there are a ton of things out there to do this, but I am kind of a roll your own guy. I learn more when I write it than when I use anothers.
Anyway, I have a config file like the following:
/opt/gvc/gvc_dtfr/port*/done/*gz 20 /opt/gvc/gvc_dtfr/log 30
The first part is the path glob and the second is the maximum mtime to keep. As you can see, the first line of the config file would not parse correctly in an opendir/readdir combination.
I would like to be able to retain this globbing ability in the config file, otherwise the top line would turn into over 100 lines if I had to enter each one seperatly.
Any Ideas on how I can use this glob quickly and efficiently in a perl program (*nix environment).
TIA, Chad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing directory glob in config file.
by chromatic (Archbishop) on Sep 13, 2002 at 21:36 UTC |