Created
August 2, 2023 21:59
-
-
Save greenido/e590cb5073573594ba5ee620208a9968 to your computer and use it in GitHub Desktop.
This bash script will back up all the files in the current directory to a .tar.gz file.
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 | |
# This script will back up all the files in the current directory to a .tar.gz file. | |
# Get the current date and time. | |
date +"%Y-%m-%d_%H:%M:%S" | |
# Create a backup file. | |
backup_file="backup_$(date +"%Y-%m-%d_%H:%M:%S").tar.gz" | |
# Tar up all of the files in the current directory. | |
tar -czvf $backup_file * | |
# Print a success message. | |
echo "Backup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment