2

I am using Cadaver to upload files via WebDAV when they appear in a folder. Cadaver needs two arguments to upload a file, the first being "put" and the second being the filename to the file, so something like: put /media/Hello would work.

Im writing to the Cadaver rcfile "put" and the name of the new file when it appears in the folder. However, many file names will have spaces in them, and there could be one space or several spaces. When putting slashes in the name for the spaces, the upload will work. For example, this would work: put /media/Hello\ New\ World.

The main question: How can I include the slashes when echoing the file name so that cadaver can upload the file?

#!/bin/bash
echo "put /media/$file" > cadaverAction
cadaver -r cadaverAction webdav.myserver.com

0 Answers0