upload.sh 736 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # Source: http://superuser.com/questions/523194/how-to-recursively-upload-a-directory-to-a-webdav-server-through-https-from-the
  3. # Use it like: ./upload.sh "_build/html" "http://msdl.cs.mcgill.ca/projects/DEVS/PythonPDEVS/documentation/"
  4. src="_build/html";
  5. cd "$(dirname "$src")";
  6. src="$(basename "$src")";
  7. root="$(pwd)";
  8. rc="$(mktemp)";
  9. {
  10. find "$src" '(' -type d -a -readable ')' \
  11. -printf 'mkcol "%p"\n';
  12. find "$src" '(' -type f -a -readable ')' \
  13. -printf 'cd "%h"\nlcd "%h"\n' \
  14. -printf 'mput "%f"\n' \
  15. -printf 'cd -\nlcd "'"$root"'"\n';
  16. echo "quit";
  17. } > "$rc";
  18. cadaver -r "$rc" "http://msdl.cs.mcgill.ca/projects/DEVS/PythonPDEVS/documentation/";
  19. rm -f "$rc";