Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Created March 5, 2023 20:23
Show Gist options
  • Save franciscojsc/896d2c7b7dea8e67c844f009e7e3e668 to your computer and use it in GitHub Desktop.
Save franciscojsc/896d2c7b7dea8e67c844f009e7e3e668 to your computer and use it in GitHub Desktop.
Sync notes from the local in Cloud Storage (Dropbox, Mega, Google Drive...)
#!/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