in reply to Re: Logging deleted files
in thread Logging deleted files
Here's the code for the suggestion I made at the bottom of my last post.
old_files:
#!/bin/sh find ... -print find ... -print find ... -print find ... -print
unlink_and_log:
#!/usr/bin/perl use strict; use warnings; use POSIX qw( strftime ); my $ts = strftime('[%Y/%m/%d %H:%M:%S]', localtime()); while (<>) { chomp; if (unlink()) { print("$ts Deleted $file\n"); } else { print("$ts Failed to delete $file\n"); } }
Usage:
old_files | unlink_and_log > unlink.log
|
|---|