Command line tool for gowebdav library.
- OS: all, which are supported by
Golang - Golang: version 1.x
- Git: version 2.14.2 at higher (required to install via
go get)
go get -u github.com/studio-b12/gowebdav/cmd/gowebdavIt is recommended to set following environment variables to improve your experience with this tool:
ROOTis an URL of target WebDAV server (e.g.https://webdav.mydomain.me/user_root_folder)USERis a login to connect to specified server (e.g.user)PASSWORDis a password to connect to specified server (e.g.p@s$w0rD)
In following examples we suppose that:
- environment variable
ROOTis set tohttps://webdav.mydomain.me/ufolder - environment variable
USERis set touser - environment variable
PASSWORDis setp@s$w0rD - folder
/ufolder/tempexists on the server - file
/ufolder/temp/file.txtexists on the server - file
/ufolder/temp/document.rtfexists on the server - file
/tmp/webdav/to_upload.txtexists on the local machine - folder
/tmp/webdav/is used to download files from the server
gowebdav -X LS tempgowebdav -X STAT temp
gowebdav -X STAT temp/file.txtgowebdav -X MKDIR temp2
gowebdav -X MKDIRALL all/folders/which-you-want/to_creategowebdav -X GET temp/document.rtf /tmp/webdav/document.rtfYou 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.txtgowebdav -X MV temp/file.txt temp/moved_file.txtgowebdav -X MV temp/file.txt temp/file-copy.txtgowebdav -X DEL temp/file.txtYou 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