in reply to Logging deleted files

While this can certainly be done in Perl and there have been a number of solutions already posted, the desired result can also be achieve with a slight change to the command.

This is the original command;

find in_some_dir, some_file_x, -mtime +y, -exec /bin/rm -f {}\;
If you change it to -
find in_some_dir, some_file_x, -mtime +y | tee /tmp/files-deleted | xa +rgs /bin/rm -rf

A list of the file deleted will be in the file named /tmp/files-deleted

Replies are listed 'Best First'.
Re^2: Logging deleted files
by MidLifeXis (Monsignor) on Oct 18, 2007 at 16:59 UTC

    Although I would not add the -r flag to the rm command. That might do more than you intend.

    --MidLifeXis

Re^2: Logging deleted files
by ikegami (Patriarch) on Oct 18, 2007 at 17:06 UTC

    Where is the timestamp added?

    Aside from that unsatisfied requirement, your solution is the same as MidLifeXis's.

      Whow, Monks that is great. I am going to try and implement some of the suggestions here and see were that goes. Perl Rocks!