Linux Commands

How to delete files older than N Days in Linux

delete files
delete files

How to delete files older than N Days

You can delete files older than N days using the find utility in Linux. The command syntax is shown below:

find <Directory_Path> -mtime <Number_Of_Days> -exec rm {} \;

Example:

find /home/grepitout/Downloads -mtime +7 -exec rm {} \;

The above command searches and delete seven days old files in the directory “/home/grepitout/Downloads“.

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

1 Comment

Click here to post a comment

Topics