The magic formula.

Here’s a little Linux command line I came up with that keeps one directory having the same number of files in it as another directory – by deleting all of the oldest files until the file count is the same:

ls /etc/assp/spam -t | tail +$((`ls /etc/assp/notspam | wc -l | sed -e ‘s/^ *//’`+1)) | xargs -i /bin/bash -c “rm /etc/assp/spam/{}”

This will probably look like complete gibberish to most people. I had to come up with it because of an issue I was having with the way that ASSP’s spam checking worked. (If you look carefully enough, you’ll see some keywords in there that relate.)

There isn’t really much point to this entry – other than that I’m a little proud to have assembled the above.

Newsflash: This is my 100th post! (I knew that I’d be making one when I noticed that my last post was number 99 – I just didn’t know what it would be.)