Question

Until now, I used Google Calender and do my personal backup with a daily wget of the public ".ics"Link.

Now I want to switch to a new Service who has only caldavaccess.

Is there a possibility to download all my caldav and carddav data with one wget / curl?

This downloaded data should give me the possibility to backup lost data.

Thanks in advance.

edit

I created a very simple php file which works in the way hmh explained. Don't know if this way works for different providers, but for mailbox.org, it works well.

You can find it here https://gist.github.com/ahemwe/a2eaae4d56ac85969cf2.

Was it helpful?

Solution

Please be more specific, what is the new service/server you are using?

This is not specifically CalDAV, but most DAV servers still provide a way to grab all events/todos using a single GET. Usually by targeting the relevant collection with a GET, e.g. like either one of those:

curl -X GET -u login -H "Accept: text/calendar" https://myserver/joe/home/
curl -X GET -u login -H "Accept: text/calendar" https://myserver/joe/home.ics

In CalDAV/CardDAV you can grab the whole contents of a collection using a PROPFIND:

curl -X PROPFIND -u login -H "Content-Type: text/xml" -H "Depth: 1" \
  --data "<propfind xmlns='DAV:'><prop><calendar-data xmlns='urn:ietf:params:xml:ns:caldav'/></prop></propfind>" \
  https://myserver/joe/home/

Replace calendar-data with

<address-data xmlns="urn:ietf:params:xml:ns:carddav"/>

for CardDAV.

This will give you an XML entity which has the iCal/vCard contents embedded. To restore it, you would need to parse the XML and extract the data (not hard).

Note: Although plain standard, some servers reject that or just omit the content (lame! file bug reports ;-).

OTHER TIPS

Specifically for people using Baïkal (>= 0.3.3; other Sabre/dav-based solutions will be similar), you can go directly to

https://<Baïkal location>/html/dav.php/

in a browser and get an html interface that allows you to download ics files, and so also allows you to find the right links for those for use with curl/wget.

I tried the accepted answer which did not work for me. With my CalDAV calendar provider I can, however, retrieve all calendar files using

wget -c -r -l 1 -nc --user='[myuser]' --password='[mypassword]' --accept=ics '[url]'

where [myuser] and [mypassword] are what you expect and [url] is the same URL as the one that you enter in your regular CalDAV software (as specified by your provider).

The command creates a directory containing all the ICS-files representing the calendar items. A similar command works for my addressbook.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top