LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   find lists current directory (https://www.linuxquestions.org/questions/linux-general-1/find-lists-current-directory-607287/)

kaprasanna 12-17-2007 03:43 AM

find lists current directory
 
Hi,

I am using find with -ctime to find files created in the last 3 days.
It lists all the files properly but also includes . (current dir) which is unnecessary.
How do I avoid it?
O/S - CentOs 4
command : find . -ctime -3
result :

. (<----Notice the . representing current dir)
./20:00:48.14-12-07.abc0.log
./22:45:32.14-12-07.abc1.log
./23:50:52.14-12-07.abc2.log
./00:14:08.15-12-07.abc3.log
./00:15:27.15-12-07.abc4.log
./00:18:16.15-12-07.abc5.log
./00:21:47.15-12-07.abc6.log
./20:00:31.16-12-07.abc7.log

By the way, find command is supposed to find only files right...? Why does it include the current directory in it?

pwc101 12-17-2007 03:47 AM

find will find anything if you don't specify what you're looking for. Thus:
Code:

find ./ -type f -ctime -3
will search for only files (-type f), thus omitting any directories, including the current one.

kaprasanna 12-17-2007 04:01 AM

That was so easy. I am kinda new to this so..
Anyways thank you very much.

pwc101 12-17-2007 04:06 AM

Quote:

Originally Posted by kaprasanna (Post 2993118)
That was so easy. I am kinda new to this so..
Anyways thank you very much.

No worries :)

I still consider myself new :)


All times are GMT -5. The time now is 01:02 PM.