#!/bin/sh BASEURL="http://localhost:8081" BASEURI="https://srs.epita.fr/owncloud/remote.php/webdav/FIC 2016" CLOUDUSER='fic' CLOUDPASS='f>t\nV33R|(+?$i*' if [ $# -gt 0 ] then WHERE=$1 else WHERE="files" fi curl -q -f ${BASEURL}/api/themes/files-bindings | while read l do FROM=$(echo "$l" | cut -d ";" -f 1) DEST=$(echo "$l" | cut -d ";" -f 2) mkdir -p $(dirname "${WHERE}${DEST}") wget -O "${WHERE}${DEST}" --user "${CLOUDUSER}" --password "${CLOUDPASS}" "${BASEURI}${FROM}" done