JisanDs/mkark_backup_script
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
# 🛡️ Advanced Linux Backup Automation A robust and intelligent Bash script to automate directory backups with dynamic timestamping, error handling, and safety checks. ## 🚀 Evolution: From Basic to Pro This project has been upgraded from a simple archiving tool to a more reliable automation script. * **Old Version:** Basic `tar` and `mv` commands without any error checks. * **Current Version:** Features dynamic naming, user interaction, and fail-safe mechanisms. ## 🛠 Enhanced Features - **Dynamic Timestamping:** Automatically generates backup names using the current date (`YYYY-MM-DD`). - **Fail-Safe Execution:** Uses `set -e` to ensure the script stops immediately if any command fails. - **Collision Detection:** Checks if a backup file or folder already exists and asks for user input to prevent overwriting. - **Smart Archiving:** Compresses all files in the directory and organizes them into a dedicated date-stamped folder. - **Auto-Cleanup:** Automatically removes the utility script (`refine.sh`) from the backup folder to keep the archive clean. - **Silent Mode:** Uses output redirection to `/dev/null` for a cleaner terminal experience during extraction. ## 🔄 Usage 1️⃣ Download `refine.sh` into the directory you want to backup. 2️⃣ Give execution permission: ```bash chmod +x refine.sh 3️⃣ Run the script: Bash ./refine.sh⚠️ Note: The script is designed to remove its own copy from the extracted backup folder to ensure the backup remains pure data. 🧪 Execution Flow Plaintext $ ./refine.sh Creating backup_2026-02-24.tar ... Tar filename: backup_2026-02-24.tar created successfully Creating backup_2026-02-24 ... Folder: backup_2026-02-24 created successfully [Processes Extraction & Cleanup...] 📝 Change Log [x] Added set -e for robust error handling. [x] Implemented dynamic date-based naming. [x] Added interactive user prompts for duplicate filenames. [x] Optimized extraction logic with directory switching.