
Bash delete files older than 30 days how to#
Ssh Root Ubuntu Logga In – Sweden Logga In on How To Allow SSH Root Login On Ubuntu 20. Here I am going to tell you how to delete backup files older than 30 days through bash scripts or command line, which help to save your system, server space &.The grep tar in the listing command is just for my own purpose to list only tar files, can be adapted of course.


mtime - Indicates the file modification time and is used to find files older than 30 days. The results from the find command will be sent into the rm command. Here, dot (.) - Indicates the current directory. The rm commands -exec command-line argument allows us to delete files.

crontab -e 0 7 /bin/bash /opt/script/delete-old-folders.

chmod +x /opt/script/delete-old-folders.sh Finally add a cronjob to automate this.
Bash delete files older than 30 days pdf#
AMD Apache centos centos 7 CentOS 8 convert debian DJI Mavic 2 Pro DNS EPEL fdisk ffmpeg FreeNAS FreeSWITCH FusionPBX Hard drive hostname iptables java Linux mysql Nginx NTP server Nvidia password port proxmox Python rdp redhat RHEL root script SIP sox SSH tcpdump Ubuntu Ubuntu 18.04 vestacp VMWARE Windows Windows 10 yum Zimbra Recent Posts Bash - Delete Files Older Than 10 Days Using Shell Script in Unix - Stack Overflow - Free download as PDF File (.pdf), Text File (.txt) or read online for. Set an executable permission to delete-old-folders.sh file.
