John Pumford-Green Tue May 3 20:09:19 2022
~/backup/config/
, ~/backup/data/
and ~/backup/bin/
~/backup/data/
directory ~/backup/bin/copy_files.sh
Inspired by : https://helgeklein.com/blog/linux-config-file-version-control-backup-on-github/
#!/bin/bash # Remove all previously copied files and folders (excluding metadata) in the current (backup) directory find /home/gm4slv/backup/data -maxdepth 1 -mindepth 1 -not -iname ".git" -not -iname ".ssh" | xargs --no-run-if-empty rm -r # Copy the files and directories on the list to the current (backup) directory # xargs does not start a shell, so we need to do it ourselves or globbing won't be available # Enable globstar (two asterisks = recurse into subdirectories) and include files starting with a dot in filename expansion cat /home/gm4slv/backup/config/backup_src.txt | xargs -I % bash -c "shopt -s globstar dotglob; cp --parents -R % ."
~/backup/config/backup_src.txt
/etc/hosts /etc/resolv.conf /home/gm4slv/codeplugs/ /home/gm4slv/python_lost_found/
~/git_backup.sh
in home directory, to fire it all off in the correct order#!/bin/bash # DATE=`date +%c` cd ~/backup/data ../bin/copy_files.sh git add --all git commit -m "updated $DATE" git push
Page Updated : 05/05/22 18:12 BST