Finding files older than a certain date


Sometime you may find that you need to files that are older than a certain date.

Let's say that you wanted to find an email from 2016, these Two simple bash command will achieve this for you.

touch --date "2017-01-01" /home/USER/2017-01-01.txt
find /home/USER/mail -type f -not -newer /home/USER/2017-01-01.txt
rm /home/USER/2017-01-01.txt

The first line is creating a file with a modified date by which you would like to search

The second line is specifying the folder in which you would like to search; In our example your mail folder

The last command is just to clean up after yourself.

Note: You will need to change the "USER" to your CPanel username.

 


Was this answer helpful?

One email a month. Endless business benefits.

Don't miss out on WMTWWFY — the newsletter that keeps your website fast, safe, and visible.

« Back
Spinner
aluminium-anthropoid Security Check