Use “-mtime n” command to return a list of files that were last modified “n” hours ago. See the format below for a better understanding. -mtime +10: This will find all files that were modified 10 days ago. -mtime -10: It will find all files that were modified in the last 10 days.
Finding Files Modified on a Specific Date in Linux: 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.
On my Fedora 10 system, with findutils-4.4.0-1.fc10.i386
:
find <path> -daystart -ctime 0 -print
The -daystart
flag tells it to calculate from the start of today instead of from 24 hours ago.
Note however that this will actually list files created or modified in the last day. find
has no options that look at the true creation date of the file.
find . -mtime -1 -type f -print
To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:
touch -t `date +%m%d0000` /tmp/$$
find . -type f -newer /tmp/$$
rm /tmp/$$
Source
I use this with some frequency:
$ ls -altrh --time-style=+%D | grep $(date +%D)
After going through many posts I found the best one that really works
find $file_path -type f -name "*.txt" -mtime -1 -printf "%f\n"
This prints only the file name like
abc.txt
not the /path/tofolder/abc.txt
Also also play around or customize with -mtime -1
Use ls or find to have all the files that were created today.
Using ls : ls -ltr | grep "$(date '+%b %e')"
Using find : cd $YOUR_DIRECTORY
; find . -ls 2>/dev/null| grep "$(date '+%b %e')"
This worked for me. Lists the files created on May 30 in the current directory.
ls -lt | grep 'May 30'
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