Last active
July 24, 2020 14:07
-
-
Save AcckiyGerman/84c5b6359f565010f0ab5122b86b6f62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOURCE_DIR="/absolute/source/dir" | |
# it is a nextcloud server in the example; in your case see the docs of your webdav server | |
DESTINATION="https://cloud.2hv.de/remote.php/webdav/target_folder/" | |
USER='user_name' | |
PASS='user_password' | |
cd "${SOURCE_DIR}" || exit | |
while IFS= read -r -d '' file | |
do | |
if [ -d "${file}" ] && [[ $file != '.' ]]; then | |
echo "create folder: ${file}" | |
curl -X MKCOL "${DESTINATION}${file}" --user "${USER}:${PASS}" | |
elif [ -f "${file}" ]; then | |
echo "upload file: ${file}" | |
curl -T "${file}" "${DESTINATION}${file}" --user "${USER}:${PASS}" | |
fi | |
done < <(find . -print0) | |
# echo "clean the source folder.." | |
# rm "${SOURCE_DIR:?}"* -vrf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment