#From: k.junk@verizon.net (Kevin VW) #Subject: automatically prune folders on an IMAP server #Newsgroups: comp.mail.imap,comp.mail.pine #Date: 20 Feb 2003 05:54:18 -0800 #Message-ID: <6726394d.0302200554.7b7a0e8a@posting.google.com> #NNTP-Posting-Host: 129.6.154.85 #NNTP-Posting-Date: 20 Feb 2003 13:54:18 GMT # # Here's a very simple way to automatically prune folders on an IMAP # server each month. I did this mainly because it is a feature not # supported by Pine. # The following expect script takes as its only argument the suffix to # append to the name of the folders to be pruned. I run this script each # month (via crontab) and pass the month-year from `date +%b-%Y`. Of # course you should modify IMAP.SERVER.COM, YOUR_ID, and YOUR_PASSWD to # reflect yourself. Also, you will probably want to change the folder # names that are pruned. In this example, Inbox.Trash and # Inbox.sent-mail are renamed and then created. This is a very stupid # script, use with caution and common sense. Somebody else can make this # script smarter if they want to. # Here's the script: #!/usr/bin/expect -f # prune folders on an IMAP server # Written by Kevin Van Workum set date [lindex $argv 0] spawn telnet IMAP.SERVER.COM 143 expect "ready" send ". login YOUR_ID YOUR_PASSWD\r" expect "ged in" send ". rename Inbox.Trash Inbox.Trash-$date\r" expect "leted" send ". create Inbox.Trash\r" expect "leted" send ". rename Inbox.sent-mail Inbox.sent-mail-$date\r" expect "leted" send ". create Inbox.sent-mail\r" expect "leted" send ". logout"