Prompt Detail:
Sure, here is a Bash script that should accomplish what you are looking for:
bash#!/bin/bash
# Get the current date in the format DDMMYY
DATE=$(date +"%d%m%y")
# Specify the path to the directory you want to back up
BACKUP_PATH="/path/to/backup"
# Create the backup file with the current date in the name
tar -cvf Backup$DATE.tar $BACKUP_PATH
# Compress the backup file
gzip Backup$DATE.tar
You will need to replace the /path/to/backup
with the actual path to the directory you want to back up. You can also adjust the naming scheme if you prefer a different format.
To run the script, save it to a file (e.g. backup.sh
), make it executable using the command chmod +x backup.sh
, and then run it using the command ./backup.sh
.
Add a comment