Skip to content

Instantly share code, notes, and snippets.

@marc-hanheide
Created October 16, 2020 14:47
Show Gist options
  • Save marc-hanheide/44fe2fc550d8e4788d78ffc427242b0e to your computer and use it in GitHub Desktop.
Save marc-hanheide/44fe2fc550d8e4788d78ffc427242b0e to your computer and use it in GitHub Desktop.
CURL upload to NextCloud shared folder
#!/bin/bash
FILEPATH="$1"
SHARED_TOKEN="Xp749RSG2K4NknT"
URL="https://lcas.lincoln.ac.uk/nextcloud/public.php/webdav"
FILENAME="`basename $FILEPATH`"
curl -X PUT -T "$FILEPATH" -u "$SHARED_TOKEN:" $URL/$FILENAME
@marc-hanheide
Copy link
Author

to download, you can use:

curl -o test.md -u "tWP5TiR9wxf3xAD:" https://lcas.lincoln.ac.uk/nextcloud/public.php/webdav with the share token or

directly do curl -o test.md https://lcas.lincoln.ac.uk/nextcloud/index.php/s/tWP5TiR9wxf3xAD/download, where /download is appended to the full share URL of a file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment