Finding files older than a certain date Print


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?

« Back

Find your perfect domain

Use our domain name search to check your dream domain name

Wide Variety of Domains

Easy Registration Process

Free WHOIS Privacy

www.
Spinner