That find expression (“-mtime +30”) menas “older than 30 days”. There is much more you can do with find – for example, printing is not the only action. There are also a galaxy of expressions you can use to seach by: owner, group owner, newer than or older than other files,...
Find files older than X days You can use themtimeparameter to find older files that have not been modified recently. Let's say you want to find files older than 30 days in the current directory. Use this command: find . -mtime +30 ...
3. Find and Delete Files Older Than x Days To find and delete files older than x days, run the following syntax: find /path/to/files* -mtime +x -exec rm {} \; For example, using the command below, search all folders under/var/logmodified over the last30days. find /var/log -typ...
To find all the files which are modified50days back. # find / -mtime 50 27. Find Last 50 Days Accessed Files To find all the files which are accessed50days back. # find / -atime 50 28. Find Last 50-100 Days Modified Files To find all the files which are modified more than50days...
This article explains how to delete files older or newer than N days, with extra examples like matching only files using a particular extension, and more. For this we'll use find, a command line tool to search for files in a directory.
The two most widely used file searching utilities accessible to Linux users are calledand. Both are good ways to find files on your system. It is up to you to decide which of these tools is appropriate in each situation. This article should give you a fundamental understanding of finding fi...
For example, find files larger than one megabyte in the/home/sara/directory: find /home/sara/ -type f -size +1M Search Files with Specific Permissions Use thefindcommand to locate files based on theirpermissions. The-permoption allows you to specify permission criteria for the search. Also, ...
Find files by modification time To find all files and directories that have been modified in the last seven days, use thisfindcommand: find . -mtime -7 To limit the output to just files, add the-type foption as shown earlier: find . -mtime -7 -type f ...
To delete files older than 30 days, run: $>find/tmp-typef-mtime+30-execrm-rf{}\; or $>find/tmp-typef-mtime+30-execrm-rf{}+ While the above commands will delete files older than 30 days, as written, they fork thermcommand each time they find a file. This search can be written...
1. Find files modified in the last 7 days First we need to get the the date for current day – 7 days and use it in the below command. forfiles /P directory /S /D +(today'date - 30 days) For example, if today’s date is Jan 11th 2015, if we need to get the files modified...