📁 文件管理
📖 官方
自动备份重要文件夹
创建自动化备份脚本,定期备份重要文件到安全位置,防止数据丢失
★★☆ 中级 15-20 min 2025年1月12日
📋
使用场景
💬
提示词
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
✨
预期结果
💡
使用技巧
- • 可以设置备份完成后的通知,这样即使你不在电脑前,也能知道备份是否成功。可以使用 macOS 的 osascript 或发送邮件通知。