Computing : Upload to DESYcloud using curl

It's quite simple to upload files, create directories on desycloud without any mounts.. A simple recipe using curl (assuming that a .netrc file has been created):

URL="https://desycloud.desy.de/remote.php/webdav/upload-dir"
# test if folder already exists, if not create it:
test=$(curl -s -n -X PROPFIND -H "Depth: 1" "$URL" | grep "200 OK" | wc -l)
if [[ $test -eq 0 ]]; then
    curl -s -n -X MKCOL "$URL" > /dev/null
fi
# since the toplevel folder exists, just create an empty one.
curl -s -n -X MKCOL "$URL/new" > /dev/null
# upload a bunch of files
for file in *.doc ; do
    curl -s -n -T "$file" "$URL/$file" > /dev/null
done