daystart option not working in find command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting daystart option not working in find command
# 1  
Old 05-13-2010
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,
https://www.unix.com/shell-programmin...day-files.html
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
# 2  
Old 05-13-2010
Quote:
Originally Posted by arunkumarmc
find . -daystart -type f -mtime 0
There is no "-daystart" option with find.
# 3  
Old 05-13-2010
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
# 4  
Old 05-13-2010
Hi.

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

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

This User Gave Thanks to Scott For This Post:
# 5  
Old 05-13-2010
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?
# 6  
Old 05-13-2010
Quote:
Originally Posted by arunkumarmc
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.
# 7  
Old 05-13-2010
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Maxdepth option of find command not working

Can you please figure out what is the issue here $ find . -maxdepth 1 -type f -size 0 -print find: bad option -maxdepth please find the OS details $ uname -a HP-UX g5u1216 B.11.31 U ia64 2614088426 unlimited-user license Use code tags, thanks. (6 Replies)
Discussion started by: TomG
6 Replies

2. Shell Programming and Scripting

Find command without -daystart

Hi All, on a Linux server I use this command to compress ONLY the files of yesterday PATH=/home/user01/logs TYPE="*" DAYS=1 find $PATH -daystart -mtime $DAYS -type f -name "$TYPE" -exec gzip -f '{}' ';' On SunOS the -daystart option is not allowed A different test is the following on SunOS... (4 Replies)
Discussion started by: gio123bgg
4 Replies

3. Shell Programming and Scripting

Confusing find command option

Hi, I am a little bit confusing of using find command. Actually, I am planning to delete the files whatever the files are existing in the day before yesterday. So, I am writing the command like this. find . -name "*.txt" -ctime -2 { here I am confusing, if I will use +2 or +1 also I am... (5 Replies)
Discussion started by: nagraju.allam
5 Replies

4. Shell Programming and Scripting

Please suggest me a better option than FIND command

Hi All, Could you please help me in searching files in a better way satisfying the below conditions I want to search files in a path whose access time is more than 5min and less than 60 min and whose Byte size is greater than zero For this, i am using the below command, but it is... (2 Replies)
Discussion started by: sparks
2 Replies

5. HP-UX

who command option not working

Running HP 11.31 on a HP3600. But when I log in as a user the who command works but if I use an option like "who -m" I get nothing. Any thoughts on what is causing this problem. (11 Replies)
Discussion started by: KMRWHUNTER
11 Replies

6. Shell Programming and Scripting

help with find command and prune option

Hi I have a directory say mydir and inside it there are many files and subdirectories and also a directory called lost+found owned by root user I want to print all files directories and subdirectorres from my directory using find command except lost+found If i do find . \( -name... (3 Replies)
Discussion started by: xiamin
3 Replies

7. UNIX for Dummies Questions & Answers

help me out with find command , -prune option

Hi , Kindly help me out .:) i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows. if i give, find . o/p is . ./t4 ./t1 ./t1/t2 ./t1/t2/t3 ./t1/t2/t3/t4 ./t1/t2/t4 ./t1/t4 directories are like t/t1/t2/t3 and each directory has file t4. my... (7 Replies)
Discussion started by: bhuvaneshlal
7 Replies

8. UNIX for Advanced & Expert Users

For ls command,-r option is not working on OSF1

There r 2 servers. Lets call them S1 and S2.. S1 is OSF1 and S2 is SunOS.. One directory of S2 is mounted on S1. say abc/xyz There is one application which continuously put xml files in that directory (on S2). If we give command “ls -lrt” on S2 it gives proper output.. (i.e. gives list... (1 Reply)
Discussion started by: asmita
1 Replies

9. Shell Programming and Scripting

-s option to find object exists not working.

is there a direct command to find whether directory is empty, -s option doesn't seem to work. Mark. (2 Replies)
Discussion started by: markjason
2 Replies

10. Solaris

Why does the 'ps' command with -u option not working?

How can I use the 'ps' command to view current sessions but only for a given process/user, with the -u parm? In older versions of Unix, this used to work, but not in Sun Solaris. Thanks (4 Replies)
Discussion started by: ElCaito
4 Replies
Login or Register to Ask a Question