Last active
August 29, 2015 14:17
-
-
Save carlos22/17141cea0d5a6f71be48 to your computer and use it in GitHub Desktop.
carddav2vcf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# args | |
if [ "$#" -eq 0 ];then | |
echo "$0 <url> <user> <file.vcf>"; | |
exit 3; | |
fi | |
DAVURL="$1"; | |
DAVUSER="$2"; | |
VCF="$3"; | |
echo -n "Password: " | |
read -s DAVPW; | |
echo ""; | |
echo "Start"; | |
# truncate file | |
echo -n > $VCF; | |
# get remote file listing | |
for i in `davix-ls --userlogin $DAVUSER --userpass $DAVPW $DAVURL`; do | |
echo "Downloading $i"; | |
# download files and append them to vcf | |
davix-get --userlogin $DAVUSER --userpass $DAVPW $DAVURL/$i >> $VCF | |
done | |
# remove empty lines | |
sed -i '/^$/d' $VCF | |
exit 0; |
Author
carlos22
commented
Mar 13, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment