Skip to content

Instantly share code, notes, and snippets.

@TomasKulhanek
Last active November 7, 2017 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomasKulhanek/c94e148159a871ee688685828da82ebd to your computer and use it in GitHub Desktop.
Save TomasKulhanek/c94e148159a871ee688685828da82ebd to your computer and use it in GitHub Desktop.
BASH sample to download or upload into WEBDAV capable URL without authentication.

Description

BASH sample to download or upload into WEBDAV capable URL without authentication. Use West-Life Virtual Folder File picker or Upload-Dir picker component to generate temporary WEBDAV url for your account.

Usage

testwebdav.sh [PUT] [webdav url to dir]/[filename] [data]

Examples

testwebdav.sh https://portal.west-life.eu/webdav/1234/README.md
# this will download the file README.md from WEBDAV url
testwebdav.sh PUT https://portal.west-life.eu/webdav/1234/README.md "this is demo text"
# this will upload the file README.md to WEBDAV url
#!/usr/bin/env bash
function help {
echo Usage:
echo - testwebdav.sh [PUT] [url] [data]
echo Samples:
echo - testwebdav.sh PUT https://portal.west-life.eu/webdav/123123/readme.txt "this is demo text"
echo - testwebdav.sh https://portal.west-life.eu/webdav/123123/readme.txt
}
if [ $# -eq 0 ]; then
help
exit
else
if [ $1 == 'PUT' ]; then
curl -X PUT $2 --data "$3"
else
curl $1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment