Skip to content

Instantly share code, notes, and snippets.

@joram77
Last active November 14, 2022 07:27
Show Gist options
  • Save joram77/dbcc62bd8834d2e0a04bdad59ec54c64 to your computer and use it in GitHub Desktop.
Save joram77/dbcc62bd8834d2e0a04bdad59ec54c64 to your computer and use it in GitHub Desktop.
# copy current dir
cp -rv . ~/backup/$(basename "$PWD").bak.$(date '+%Y-%m-%d_%H-%M-%S')
# or tar current dir
tar -cvzf ~/backup/$(basename "$PWD").bak.$(date '+%Y-%m-%d_%H-%M-%S').tar.gz .
# tar current dir and exclude dot dirs/files in root to tar
tar --exclude="./.*" -cvzf /tmp/backup/$(basename "$PWD").bak.$(date '+%Y-%m-%d_%H-%M-%S').tar.gz .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment