Skip to content

Instantly share code, notes, and snippets.

@aristotelis-economides
Created July 2, 2023 14:13
Show Gist options
  • Save aristotelis-economides/65386bfe180b0bc104210567aba785be to your computer and use it in GitHub Desktop.
Save aristotelis-economides/65386bfe180b0bc104210567aba785be to your computer and use it in GitHub Desktop.
Simple script for backing up your notes
#!/bin/bash
# Path to your notes
SOURCE_DIR="$HOME/Documents/notes/"
# Path to save backups
DEST_DIR="$HOME/Nextcloud/Backups/note-backups"
# The actual filename to use for current backup e.g. notes-2023-07-03.tar.gz
BACKUP_FILE="${DEST_DIR}/notes-$(date +'%Y-%m-%d').tar.gz"
# Compress all the files in SOURCE_DIR and save them to BACKUP_FILE
tar -czf "${BACKUP_FILE}" "${SOURCE_DIR}"
echo "Finished running $0."
echo "If all went smoothly, backup should be at ${BACKUP_FILE}"
@aristotelis-economides
Copy link
Author

Script accompanying the post Simple automated backup for markdown notes on aristot.io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment