keralaqueen234 has asked for the wisdom of the Perl Monks concerning the following question:
i have a requirement where in i need to delete all the old log files in a folder.Log file will be having the extn of .log. But the thing is recent log file need not be deleted . For example if i have a folder say xyz and inside that foleder i have 3 log files named 1)currentlog.log 2)currentlog_2010.log 3)currentlog_2011.log and some other .txt files with some names are also present.please note , currentlog.log is the recent logfile .So this need not be deleted. i need to delete all the other log files that has the name pattern 'currentlog*' .Pleasenote ,the recent logfile and other .txt files should be retained.on trigering the perlscript only currentlog_2010.log ,currentlog_2011.log should get deleted.How to do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleting a file in perl
by hdb (Monsignor) on Apr 02, 2013 at 06:17 UTC | |
by keralaqueen234 (Initiate) on Apr 02, 2013 at 06:53 UTC | |
by hdb (Monsignor) on Apr 02, 2013 at 07:01 UTC | |
|
Re: deleting a file in perl
by CountZero (Bishop) on Apr 02, 2013 at 06:18 UTC | |
|
Re: deleting a file in perl
by kcott (Archbishop) on Apr 02, 2013 at 09:10 UTC | |
|
Re: deleting a file in perl
by 2teez (Vicar) on Apr 02, 2013 at 06:44 UTC | |
| |
|
Re: deleting a file in perl
by pvaldes (Chaplain) on Apr 02, 2013 at 09:04 UTC |