Another entry in my virtual “braindump” category, so I don’t have to look it up somewhere else all the time.

If you want to periodically delete files in a specific directory the unix program find comes to the rescue. In my specific case I needed to delete all the movie files from a surveillance camera that where older than 30 days.

This is the crontab entry to accomplish that:
0 0 * * * /usr/bin/find /videos/ -type f -name '*.avi' -mtime +30 -exec rm {} \;
(everything in one line)

The code runs the program /usr/bin/find every day at midnight (0 0 * * *). It checks the directory called /videos for everything that is a file (-type f), has a name that ends in .avi (-name '*.avi') and is created 30 days ago or before that (-mtime +30).
The command then executes rm (remove) on all those files (-exec rm {} \;).

Since I sometimes had very poor Internet connections over the last few month I thought about how I could lower the data transfer volume on my Mac. One of the things that already bothered me since ages is that Exchange accounts in Apple Mail always sync the Public Folders. I never want to read those items and they are really useless.

After a bit of searching around I found two solutions that worked for me. One is only applicable if you are a Domain Administrator on the Exchange server, the other one is not so elegant but also works if you just have a mail account.

As Domain Administrator

  1. Log into the Exchange server and open the “Active Directory Users and Computers” management console.
  2. Find your acoount, click on “Properties” and select the “Exchange Features” tab
  3. Select “IMAP4” and click on “Properties”
  4. Disable “Use protocol defaults” and uncheck “Include all public folders when a folder list is requested”

Now give the Exchange some time to get the changes. After a while the Public Folders shouldn’t be displayed any more and when syncing this IMAP account they are left out as well.

On your local account

  1. Quit Mail
  2. Go to ~/Library/Mail/ (that’s the Library folder in your home directory) and find the folder that holds all the folders & messages for the Exchange account.
  3. Delete all the contents of “Public Folders” (always back-up first, before you delete 😉 )
  4. Select “Public Folders” and press CMD+I to get the Info. (or CTRL+click on it and select “Get Info”)
  5. Now under “Ownership & Permissions” set the folder to “No Access”
  6. Start Mail and observe the beauty of an Exchange IMAP account that doesn’t do useless Public Folders syncing!

I updated the kernel image via aptitude on one of my Debian Sarge servers but after a reboot it didn’t come up again. My first thought was that maybe there was something wrong with the boot loader and since I already wanted to switch from Lilo to Grub I took the opportunity and did just that.

Luckily the changeover is very easy, just follow those steps:

  1. aptitude install grub
  2. grub-install /dev/hda (Replace /dev/hda with the disk you want to install your bootloader on)
  3. update-grub to create the file menu.lst which holds all the information for booting with Grub
  4. Now we have to remove Lilo: aptitude purge lilo

That’s all folks! 🙂

If you want to automatically update the menu.lst whenever you install a new kernel, add the following to /etc/kernel-img.conf:
do_bootloader = no
do_initrd = Yes
postinst_hook = /sbin/update-grub
postrm_hook = /sbin/update-grub

…and now, reboot!