你这里的 “debian recycle” 我理解可能是指 Debian 系统下的回收站(recycle/bin)清理,常见情况有两种:
Debian 桌面(GNOME / KDE 等)的回收站在:
~/.local/share/Trash/
每天凌晨清理 7 天前的文件:
crontab -e
添加:
0 0 * * * find ~/.local/share/Trash -type f -mtime +7 -delete
例如你把删除的文件移到 /recycle
crontab -e
0 2 * * * find /recycle -type f -mtime +30 -delete
如果你不想用 cron:
sudo nano /etc/systemd/system/clean-recycle.service
[Unit]
Description=Clean recycle directory
[Service]
Type=oneshot
ExecStart=/usr/bin/find /recycle -type f -mtime +30 -delete
sudo nano /etc/systemd/system/clean-recycle.timer
[Unit]
Description=Daily recycle clean
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl enable --now clean-recycle.timer
可以告诉我:
我可以给你更精确的定时清理方案。
如果你愿意,也可以直接贴一下你说的 “debian recycle” 是哪里看到的。