pkg/gowebdav/cmd/gowebdav/README.md
Command line tool for gowebdav library.
Golanggo get)go get -u github.com/studio-b12/gowebdav/cmd/gowebdav
It is recommended to set following environment variables to improve your experience with this tool:
ROOT is an URL of target WebDAV server (e.g. https://webdav.mydomain.me/user_root_folder)USER is a login to connect to specified server (e.g. user)PASSWORD is a password to connect to specified server (e.g. p@s$w0rD)In following examples we suppose that:
ROOT is set to https://webdav.mydomain.me/ufolderUSER is set to userPASSWORD is set p@s$w0rD/ufolder/temp exists on the server/ufolder/temp/file.txt exists on the server/ufolder/temp/document.rtf exists on the server/tmp/webdav/to_upload.txt exists on the local machine/tmp/webdav/ is used to download files from the servergowebdav -X LS temp
gowebdav -X STAT temp
gowebdav -X STAT temp/file.txt
gowebdav -X MKDIR temp2
gowebdav -X MKDIRALL all/folders/which-you-want/to_create
gowebdav -X GET temp/document.rtf /tmp/webdav/document.rtf
You may do not specify target local path, in this case file will be downloaded to the current folder with the
gowebdav -X PUT temp/uploaded.txt /tmp/webdav/to_upload.txt
gowebdav -X MV temp/file.txt temp/moved_file.txt
gowebdav -X MV temp/file.txt temp/file-copy.txt
gowebdav -X DEL temp/file.txt
You can create wrapper script for your server (via $EDITOR ./dav && chmod a+x ./dav) and add following content to it:
#!/bin/sh
ROOT="https://my.dav.server/" \
USER="foo" \
PASSWORD="$(pass dav/[email protected])" \
gowebdav $@
It allows you to use pass or similar tools to retrieve the password.
Using the dav wrapper:
$ ./dav -X LS /
$ echo hi dav! > hello && ./dav -X PUT /hello
$ ./dav -X STAT /hello
$ ./dav -X PUT /hello_dav hello
$ ./dav -X GET /hello_dav
$ ./dav -X GET /hello_dav hello.txt