|
remove old items from Calendar |
|
|
|
Written by Patrik Gfeller
|
|
Saturday, 12 May 2007 |
|
Since I use my calendar since several years the size of the file has grown to more than 1.5 MB; which starts to slow down some applications (especially on my PDA). So I looked arround how to get rid of old data ...
On one of the Ximian-Lists a similar problem was discussed a while ago. There Kyle Davenport published a short perl-script, which can be used for this: it just removes all entries, except the ones for the year specified: #!/usr/bin/perl # filter out old vcalendar entries $DATA = `cat mycalendar.ics`; $DATA =~ s/(.*?)BEGIN:VEVENT/BEGIN:VEVENT/s; print "$1"; while ( $DATA =~ /BEGIN:VEVENT/ ) { $DATA =~ s/(BEGIN:VEVENT.*?END:VEVENT)(.*)/$2/s; if ( grep /DATE:2007/,($1) ) { print "$1\n"; } } # end of [while] print $DATA;
|
|
Last Updated ( Saturday, 12 May 2007 )
|