Jump to content

Recommended Posts

Posted

Write a BASH script that performs a backup of a specified directory to a target location. The script should include the following functionality:

Basic Requirements:

  1. Accept two arguments:
    • Source directory
    • Target backup location
  2. Verify that both the source and target locations exist.
  3. Create a timestamped backup folder in the target location.
  4. Log the backup process, including the time taken and the number of files backed up.

Bonus Features:

  • Implement compression (e.g., using tar or zip) for the backup.
  • Add error handling to catch issues like missing arguments or permission errors.
  • Allow for incremental backups by only copying new or modified files.

Example Usage:

./backup.sh /home/user/documents /mnt/backup

Example Output:

Backup started at: 2025-01-06 10:35:21
Backing up /home/user/documents to /mnt/backup/backup_20250106
Number of files backed up: 124
Backup completed in: 2 minutes

CodeName: Jessica

💻 Linux Enthusiast | 🌍 Adventurer | 🦄 Unicorn 
🌐 My Site | 📢 Join the Forum

spacer.png

 

  • Jessica Brown changed the title to Programming Challenge: File Backup Script (BASH) (Jan 6, 2025)

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.