[nycbug-talk] Deleting Lots of Files.

George Georgalis george at galis.org
Wed Jun 21 16:41:02 EDT 2006

On Wed, Jun 21, 2006 at 01:42:24PM -0400, N.J. Thomas wrote:
>* N.J. Thomas <njt at ayvali.org> [2006-06-21 10:56:53 -0400]:
>> "-mtime -16" to get the files before June (but also see the -newer
>> option).
>A minor correction, for today (2006-06-21), "-mtime +21" is the correct
>switch to find files before June, "-mtime -16" would get you all files
>newer than 16 days ago. Sorry about the mistake.
>But for something like this:
>    touch -amt 200606010000.00 foo
>    find . ! -newer foo
>is more exact and is probably what the OP should use.

Well now I think I know what the OP is up to....
I have lots of lines like this in my crontab

00 4 * * * d=openvpn        ; find ~/Mail/${d} -type f -mtime +21 -exec mv \{\} ~/Mail/${d}.old/cur/ \;
30 4 * * * d=openvpn.old    ; find ~/Mail/${d} -type f -mtime +84 -exec rm \{\} \;

The first one trims down my openvpn mailbox by moving messages
older than 21 days to openvpn.old (prepared when I created the
crontab line).  The second line drops messages older that 84 days
from my openvpn.old mailbox (which mutt doesn't check but which
I can look in if I want/need). Different list have different
cutoffs so my mailboxes remain at reasonable size.

Yeah I should probably use safecat or some such vs mv, but I'm not
too worried.

// George

George Georgalis, systems architect, administrator <IXOYE><

More information about the talk mailing list