How do I adapt this to return recursively files of only extension *.php? thx!
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort
Method 1: Using stat command. Stat command can be used to display timestamps of a file. Example 2: Using the ls command. By using this command you can list only today's files in your home folder.
-mtime n is an expression that finds the files and directories that have been modified exactly n days ago. In addition, the expression can be used in two other ways: -mtime +n = finds the files and directories modified more than n days ago. -mtime -n = finds the files and directories modified less than n days ago.
You can use the ls command to list files including their modification date by adding the -lt flag as shown in the example below. The flag -l is used to format the output as a log. The flag -t is used to list last modified files, newer first.
find is the Unix command line tool for finding files (and more) /directory/path/ is the directory path where to look for files that have been modified. Replace it with the path of the directory where you want to look for files that have been modified in the last N days.
Add -name '*.php'
:
find . -type f -name '*.php' -printf '%TY-%Tm-%Td %TT %p\n' | sort
Note that since the expression is evaluated by find
from left to right you must specify the -name
test before the -printf
action.
See this manpage for details about tests, actions and how find evaluates your expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With