Jump to content

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 89
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

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.