Shell Backup

 avatar
user_5062492
plain_text
2 months ago
516 B
1
Indexable
Never
#!/bin/bash

# Source directory (replace with your actual source directory)
source_dir="/path/to/your/source"

# Backup directory (replace with your desired backup directory)
backup_dir="/path/to/your/backup"

# Create backup directory if it doesn't exist
mkdir -p "$backup_dir"

# Timestamp for backup folder
timestamp=$(date +"%Y%m%d_%H%M%S")
backup_folder="$backup_dir/backup_$timestamp"

# Copy files to backup folder
cp -r "$source_dir" "$backup_folder"

echo "Backup completed. Files copied to: $backup_folder"