Return to Snippet

Revision: 35210
at November 23, 2010 23:55 by uptimejeff


Updated Code
#!/bin/sh

### VARIABLES ###

# Path to user's ical server directory this is where a folder exists for each calendar.
calpath="/Volumes/Data/iCal/calendars/__uids__/AC/03/AC0339D9-5D40-41CD-B1C8-4A62333C53FD"

# Where to store combined ics files
# typically this is a a folder in your web server path.
calout="/Volumes/Data/Web/mydomain/ics"


### Do not edit below this line ###
cals=`ls $calpath | grep -v dropbox | grep -v inbox`

TEMP="/tmp/temp.ics"

for cal in $cals; do

echo "BEGIN:VCALENDAR
PRODID:-//merge//example.com//
VERSION:2.0
X-WR-CALNAME:example.com" > $TEMP

awk '/BEGIN:VEVENT/,/END:VEVENT/' $calpath/$cal/*.ics >> $TEMP

echo "END:VCALENDAR" >> $TEMP

tr -d '\r' < $TEMP > $calout/$cal.ics

done

exit 0

Revision: 35209
at November 4, 2010 05:12 by uptimejeff


Initial Code
#!/bin/sh

### VARIABLES ###

# Path to user's ical server directory this is where a folder exists for each calendar.
calpath="/Volumes/Data/iCal/calendars/__uids__/AC/03/AC0339D9-5D40-41CD-B1C8-4A62333C53FD"

# Where to store combined ics files
# typically this is a a folder in your web server path.
calout="Volumes/Data/Web/mydomain/ics"


### Do not edit below this line ###
cals=`ls $calpath | grep -v dropbox | grep -v inbox`

TEMP="/tmp/temp.ics"

for cal in $cals; do

echo "BEGIN:VCALENDAR
PRODID:-//merge//example.com//
VERSION:2.0
X-WR-CALNAME:example.com" > $TEMP

awk '/BEGIN:VEVENT/,/END:VEVENT/' $calpath/$cal/*.ics >> $TEMP

echo "END:VCALENDAR" >> $TEMP

tr -d '\r' < $TEMP > $calout/$cal.ics

done

exit 0

Initial URL


Initial Description
Combines .ics files from OS X Server iCal Server into a single merged ics which can then be subscribed to.
I set this up specifically so I could display ical server calendars inside of Zap Calendar on a joomla site. This script could be called from cron.

Initial Title
iCal Server Merge-ics

Initial Tags
server

Initial Language
Bash