ppantazis has asked for the wisdom of the Perl Monks concerning the following question:
Monks, I have a perl script that is basically a collection of
find in_some_dir, some_file_x, -mtime +y, -exec /bin/rm -f {}\;
statements like the one above. These work great no problem. There are probably 50 or 60 of them. What I would like to do is log the files that each of the commands deleted. So if teh command above matched 10 files I would like to dump the results into a log file in the form:
File foo_1 deleted timestamp File foo_2 deleted timestamp etc.
What Perl constructs do I need to be looking at? how can this be done using Perl?
your help is appreciated.
20071019 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Logging deleted files
by ikegami (Patriarch) on Oct 17, 2007 at 21:32 UTC | |
by ikegami (Patriarch) on Oct 17, 2007 at 21:49 UTC | |
by Bloodnok (Vicar) on Oct 18, 2007 at 13:22 UTC | |
|
Re: Logging deleted files
by gamache (Friar) on Oct 17, 2007 at 21:32 UTC | |
|
Re: Logging deleted files
by MidLifeXis (Monsignor) on Oct 17, 2007 at 21:33 UTC | |
by ppantazis (Initiate) on Oct 18, 2007 at 21:41 UTC | |
by MidLifeXis (Monsignor) on Oct 19, 2007 at 21:22 UTC | |
by Anonymous Monk on Oct 23, 2007 at 14:49 UTC | |
by MidLifeXis (Monsignor) on Oct 23, 2007 at 21:10 UTC | |
|
Re: Logging deleted files
by bruceb3 (Pilgrim) on Oct 18, 2007 at 00:51 UTC | |
by MidLifeXis (Monsignor) on Oct 18, 2007 at 16:59 UTC | |
by ikegami (Patriarch) on Oct 18, 2007 at 17:06 UTC | |
by ppantazis (Initiate) on Oct 18, 2007 at 19:36 UTC |