Created
March 5, 2023 20:23
-
-
Save franciscojsc/896d2c7b7dea8e67c844f009e7e3e668 to your computer and use it in GitHub Desktop.
Sync notes from the local in Cloud Storage (Dropbox, Mega, Google Drive...)
This file contains 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
#!/bin/bash | |
# Autor: Francisco Chaves | |
# Website: https://franciscochaves.com.br | |
# Description: Sync notes from the local in Cloud Storage | |
# How to configure | |
# contrabe -e | |
# Add a line | |
# 0 * * * * bash /path-to-script/sync-notes.sh | |
PATH_FILE_ORIGIN="path-to-local-files" | |
PATH_FILE_DESTINY="path-to-cloud-files" | |
function message { | |
export DISPLAY=:0.0 | |
/usr/bin/notify-send "$1 - 📌" -i "gnome-terminal" | |
} | |
if [ -d ${PATH_FILE_DESTINY} ] && [ -d ${PATH_FILE_ORIGIN} ]; | |
then | |
cd ${PATH_FILE_DESTINY} | |
rm -R * | |
cd ${PATH_FILE_ORIGIN} | |
for FILE in *; | |
do ln "${FILE}" "${PATH_FILE_DESTINY}/${FILE}"; | |
done; | |
message "Sync Notes Sucess" | |
exit 0 | |
else | |
message "Path of file no found" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment