Find the file created on current date

Hi All,

I'm trying to find a file which is created on current day.... I searched in unix.com and i found, below command.

find /land/ -mtime -1 -type f -print  | grep "FF_Member_STG.dat"

The command checks if the file with name "FF_Member_STG.dat" is created today then exit else proceed.

The problem with this command is, it takes last 24 hours (-mtime -1) and if i execute the process in 24 hours, it is not working as expected.

Can someone help me on what would be the solution?

In what way is it not working "as expected"? What, exactly, goes wrong?

You can narrow that down, and make it much faster, by searching in a folder inside /land/.

Hi Corona688,

Let's say if i am executing the process on 11/20/2014 at 3:00 PM.

On next day (11/21), if i execute the same process on 11:00 AM, it will assume the file is of today (as it is yet to pass 24 hours) and it will come out from the process.

But if you see, the date has been changed. so even if process creates file on 23:58 and next time i run on 00:05, it should continue the process, rather than exiting it.

Hi

Try inserting -daystart before -mtime -1 :

find /land/ -daystart -mtime -1 -type f -print  | grep "FF_Member_STG.dat"