Ubuntu clean (remove) tmp file every 30 days

create /etc/tmpfiles.d/tmp.conf

d /tmp 1777 root root 30d

test it

systemd-tmpfiles --clean tmp.conf

刪除 90 天前的目錄 (含目前內檔案)

find  /path/to/directory -type d -mtime +90 -exec rm -rf {} \;

指定僅目錄

-typd d 

例尋找、列出,不刪除

find  /path/to/directory -type d -mtime +90