I
I
I_AM_SHEF2020-01-07 14:06:01
bash
I_AM_SHEF, 2020-01-07 14:06:01

Script to remove directories older than 3 months?

Colleagues, good afternoon!
There is a directory, let's say "/etc/f1/".
Directories are created in it daily, like "01/01/2020"; "01/02/2020", etc.
I want to delete directories older than 3 months automatically. To do this, I make a script and add it to cron.
Actually the question itself is how to correctly set a regular expression? Something like "rm -rf /etc/f1/{01-31}.{1-12}.2020.
PS Simply using -mtime 90 is not an option, because there will be other files in that directory.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SOTVM, 2020-01-07
@I_AM_SHEF

something like this
find /etc/f1 -maxdepth 1 -type d -mtime 90 -exec rm -rf {} \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question