0

I've created some folders with a year-month stamp on them (ex: 2023-03). I've tried creating a crontab script to delete folders older than 2 months. In the directory I would have folders like 2023-03 2023-04 2023-05 2023-06.

The crontab command I used is the following:

2 0 1 * * rm -rf /media/kube/SQLBackups/$(date +%Y-%m --date="3 months ago")

Unfortunately it does not seem to be working in crontab but works via regular command line. Is there a reason for this?

0 Answers0