-5

I have a folder with large files in centos and how to delete the files older than 30 minutes.

Please suggest your ideas and snippets

Mofi
  • 46,139
  • 17
  • 80
  • 143

1 Answers1

0

It's simple. just use find and add the following line incrontab:

30 * * * * find /path/to/dir -type f -mmin +30 -exec rm -f {} \;

the above command will run every 30 minutes and delete ONLY files older that 30 minutes from the directory /path/to/dir

AnythingIsFine
  • 1,777
  • 13
  • 11