daystart option not working in find command

Hi,

I am trying to list all the files created / modified today in a directory.
With reference to this thread,

I have used the below command to list all the files modified today.
find . -daystart -type f -mtime 0
but i am getting this exception -
find: bad option -daystart
find: path-list predicate-list

I am using bourne shell in SUNOS.
Please let me know how to solve this issue.

Regards
Arun

There is no "-daystart" option with find.

Hi,

Thanks for you response..
Is there any possibility to list the files which are created / modified today?
-mtime options list the files modified in the last 24 hrs. but I need to find files only that are modified today not in the last 24hrs.

Regards
Arun

Hi.

One option is to "touch" a file, and then use the find -newer option.

i.e.

$ touch $(date '+%m%d')0000 TODAY
$ find . -newer TODAY

Hi Scott,

Thanks for you reply.
If so, should i need to include this touch command in the script each time at midnight to find the list for current date files?

Hi arunkumarmc.

You can run the touch command at any time, doesn't have to be midnight. Just include it in your script before you do the find.

Hi Scott,

As i am suppose to list the current date files, i meant to add it at midnight so that i will get all the files modified today.

Moreover i cant run the script again, if so this touch will update the time stamp to now, and i will be getting the list of files which are modified from this time only and not from 00 hours...

Am i right?

Hi.

Well, the touch command will update the timestamp of the named file (in this case TODAY) back to midnight of the current day.

Run that whenever you like, before you run your find command and it'll show which files have changed since midnight (i.e. today).

If it's not clear, perhaps you could give more context about your script (i.e. when you plan to run it, and how)?

Cheers

Hi Scott,

Sorry I misunderstood in the initial stage.. Now i am clear with and this command is very useful to me...
Thanks for you help!!!