How can I delete files older than a certain date in Linux?

Stasenndb

New member
How can I delete files older than a certain date in Linux?
Answer
How to delete all files before a certain date in Linux
  1. find – the command that finds the files.
  2. . – …
  3. -type f – this means only files. …
  4. -mtime +XXX – replace XXX with the number of days you want to go back. …
  5. -maxdepth 1 – this means it will not go into sub folders of the working directory.
  6. -exec rm {} ; – this deletes any files that match the previous settings.
15 сент. 2015 г.
 

Tìm kiếm

Back
Top