How do you delete files older than specific date in Linux?

VRK picture VRK · Oct 13, 2015 · Viewed 54.6k times · Source

I used the below command to delete files older than a year.

  find /path/* -mtime +365 -exec rm -rf {} \;

But now I want to delete all files whose modified time is older than 01 Jan 2014. How do I do this in Linux?

Answer

Paul Spaulding picture Paul Spaulding · Aug 25, 2017

This works for me:

find /path ! -newermt "YYYY-MM-DD HH:MM:SS" | xargs rm -rf