Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux deletes files 30 days ago under a folder

Shulou Source: shulou.com Published: 2022-06-02 23:19:21 11月23日 Update

Delete files periodically through the cron job of Linux

# change to the corresponding directory # cd / etc/cron.daily # create a new executable file clear#vi logcron# enter the following content #! / bin/sh # here implement the command find / logs-type f-ctime + 30 | xargs rm-rf # then save the file, and finally execute the following command to give the file service executable permission # chmod + x / etc/cron.daily/logcron

Tags: Files commands contents permissions directories switches services inputs folders Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Huawei Shulou Technology Redmi macOS