Jump to content

Programming Challenge: File Backup Script (BASH) (Jan 6, 2025)

Featured Replies

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
  • Jessica Brown changed the title to Programming Challenge: File Backup Script (BASH) (Jan 6, 2025)
  • Views 166
  • Created
  • Last Reply

Create an account or sign in to comment

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.