Files generated today

I would like to find the Files which are generated today in the current directory:

I use the commad ls -lrt * | egrep " `date "+%b"` * `date "+%d"`
to acheive this. Is there any better way to acquire the same.

Multiple answers will be great. Thanks

Use find command with -mtime option.

We can't find the files generated today(file creation date can be found only on ext4 filesystems), only files with today's timestamp can be found.

find . -mtime -1
ls -l | grep `date +%Y-%m-%d`

this again depends on how your ls lists the files.

HTH
--ahamed

This is a syntax error. There is an odd number of double quotes. Also the "%d" switch to "date" gives a day number with leading zeros.
Please post a sample "ls -l" listing so we can see what the date looks like in your "ls" listing for single and double digit days.

My crude method for directory listing where the date format is "Mmm dD" (day with leading space). The grep for a colon is a crude way of avoiding previous years. Processing a formatted directory listing is not perfect for many reasons but it will often do the job if you have simple boring filenames which do not contain colons or formatted dates.

#!/bin/ksh
TODAY="`date '+%b %e'`"        # Mmm dD
ls -lrt | grep "${TODAY}"|grep ":"

Ps. There is a much better method using find, but not with the "-mtime" switch". It involves creating a timestamp reference file with "touch" and using "find -newer".