📁 File Management 📖 Official

Automatische Ordner-Sicherung

Erstellen Sie automatisierte Backup-Skripte für wichtige Ordner, um Datenverlust zu verhindern

★★☆ Intermediate 15-20 min 12. Januar 2025
📋

Scenario

💬

Prompt

I need to create a backup plan:
- Source directories: ~/Documents/Work and ~/Projects
- Backup to: /Volumes/Backup/MyBackup
- Frequency: Every day at 10 PM
- Keep the last 7 days of backups
- Compress backup files to save space

Please create a backup script with these features:
1. Check if backup destination is available
2. Use rsync for incremental backup
3. Create timestamped folders for each backup
4. Compress old backups (older than 3 days)
5. Automatically delete backups older than 7 days
6. Log backup activities to ~/backup.log
And save the script to ~/backup_script.sh

Expected Result

💡

Tips

  • Sie können Benachrichtigungen einrichten, wenn das Backup abgeschlossen ist, damit Sie wissen, ob das Backup erfolgreich war, auch wenn Sie nicht am Computer sind. Sie können macOS osascript oder E-Mail-Benachrichtigungen verwenden.