LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-17-2007, 03:43 AM   #1
kaprasanna
LQ Newbie
 
Registered: Mar 2007
Posts: 14

Rep: Reputation: 0
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?
 
Old 12-17-2007, 03:47 AM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
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.
 
Old 12-17-2007, 04:01 AM   #3
kaprasanna
LQ Newbie
 
Registered: Mar 2007
Posts: 14

Original Poster
Rep: Reputation: 0
That was so easy. I am kinda new to this so..
Anyways thank you very much.
 
Old 12-17-2007, 04:06 AM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by kaprasanna View Post
That was so easy. I am kinda new to this so..
Anyways thank you very much.
No worries

I still consider myself new
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java phone directory using linked lists snowman81 Programming 1 11-27-2007 07:35 PM
Bash to find and disect current working Directory carl0ski Linux - General 4 10-28-2006 04:36 AM
find in current directory ramanadyv Linux - Newbie 3 03-28-2006 10:12 PM
how do I find out the current working directory? nodger Programming 2 12-26-2004 11:28 AM
Source lists for apt-get, where may I find? geraldomanaus Debian 1 09-27-2003 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration