public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: LS -R (Cygwin, latest builds as of 8/15/02, Win2K box)
@ 2002-08-21 11:15 Robb, Sam
  0 siblings, 0 replies; 4+ messages in thread
From: Robb, Sam @ 2002-08-21 11:15 UTC (permalink / raw)
  To: cygwin

Travis,

  Try this:

  find . -name '*.db'

  Or, if you have symlinks under the current directory that you want to
dereference and search:

  find . -follow -name '*.db'

  If you don't escape the * in the command, then the shell expands it for
you.  If you have a directory that contains two files, a.db and b.db, then:

  find . -name *.db

  ... will be expanded by the shell to be:

  find . -name a.db b.db

  ... which leads to the "find: paths must precede expression" error (almost
certianly not what you want :-)

  Worse, if you have a directory with one file in it named a.db, then the
same command will be expanded by the shell to be

  find . -name a.db

  ... which will find all occurances of a file named a.db under the current
directory.  Probably not what you want, and all the more annoying because
find will do exactly what you told it to do, even though that's not what
you *meant* for it to do :-/

-Samrobb

-----Original Message-----
From: My Avatar [mailto:myavatar@yahoo.com]
Sent: Wednesday, August 21, 2002 12:50 PM
To: cygwin@cygwin.com
Subject: LS -R (Cygwin, latest builds as of 8/15/02, Win2K box)


I've read all the FAQs, Groups, MsgBoards, & Cygwin 
archives I can find, and although I have found some 
user's with similiar problems, none of them ever 
seemed to be resolved (as far as I could tell). 

My problem is this. I am trying to use the -R switch 
with ls to get a listing of files that I am going 
to send to sort (to get a top 10 kind of thing). I 
am very fearful that this is going to be flame bait, 
but feel I have done all I humanly can right now to 
resolve the issue on my own. 

When I enter ls -R *.db, it only returns the matching 
files in the current path (and I verified that there 
are matching files in the subdirs). 

Here is one thread that almost seems similiar, but 
doesnt seem to be resolved... 
http://www.cygwin.com/ml/cygwin/1999-08/msg00578.html 
...when I try to do as the author suggests, I get the 
following messgage... 
$ find . -name *.db 
find: paths must precede expression 
Usage: find [path...] [expression] 

...so I tried... 
$ find /cygdrive/s/customer/ -name *.db 
find: paths must precede expression 
Usage: find [path...] [expression] 

Here is an example of what happens with LS... 
$ ls *.db 
Copy of Langdef.db RSINFO.db S98pcta.db langFltr.db
qClass.db 

Administrator@TRAVIS /cygdrive/s/customer/dist10 
$ cd .. 

Administrator@TRAVIS /cygdrive/s/customer 
$ ls -R *.db 
ALPHACLS.db ALPHAGRD.db dist.db olddist.db 

Administrator@TRAVIS /cygdrive/s/customer 
$ ls *.db 
ALPHACLS.db ALPHAGRD.db dist.db olddist.db 

Your thoughts? 
Travis Johnson 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LS -R (Cygwin, latest builds as of 8/15/02, Win2K box)
  2002-08-21 11:57 ` Don Sharp
@ 2002-08-23 12:59   ` My Avatar
  0 siblings, 0 replies; 4+ messages in thread
From: My Avatar @ 2002-08-23 12:59 UTC (permalink / raw)
  To: Don Sharp, Polley Christopher W; +Cc: gnuwin32

Thank you all, and my sincerest apologies (even
after searching, it appears I posted an off topic
post).  Even so, thank you.

Regards,
Travis Johnson

--- Don Sharp <dwsharp@iee.org> wrote:
> My Avatar wrote:
> > 
> > I've read all the FAQs, Groups, MsgBoards, &
> Cygwin
> > archives I can find, and although I have found
> some
> > user's with similiar problems, none of them ever
> > seemed to be resolved (as far as I could tell).
> > 
> > My problem is this. I am trying to use the -R
> switch
> > with ls to get a listing of files that I am going
> > to send to sort (to get a top 10 kind of thing). I
> > am very fearful that this is going to be flame
> bait,
> > but feel I have done all I humanly can right now
> to
> > resolve the issue on my own.
> > 
> > When I enter ls -R *.db, it only returns the
> matching
> > files in the current path (and I verified that
> there
> > are matching files in the subdirs).
> > 
> 
> I think you are falling into the trap of thinking
> that -R will operate
> on '.' as though it had been included in your
> argument list. Descent
> into sub directories will only occur if the *.db
> expands into at least
> one argument which is a directory, whereupon its sub
> directories will be
> explored.
> 
> Note that it would list all the contents of such sub
> directories, it
> wouldn't prepend the directory name to your *.db.
> 
> > Here is one thread that almost seems similiar, but
> > doesnt seem to be resolved...
> >
>
http://www.cygwin.com/ml/cygwin/1999-08/msg00578.html
> > ...when I try to do as the author suggests, I get
> the
> > following messgage...
> > $ find . -name *.db
> > find: paths must precede expression
> > Usage: find [path...] [expression]
> > 
> > ...so I tried...
> > $ find /cygdrive/s/customer/ -name *.db
> > find: paths must precede expression
> > Usage: find [path...] [expression]
> > 
> 
> This is because you should have put single quotes
> around the *.db
> 
> like
>     find . -name '*.db'
> 
> to avoid shell expansion of the *.db
> 
> > Here is an example of what happens with LS...
> > $ ls *.db
> > Copy of Langdef.db RSINFO.db S98pcta.db
> langFltr.db
> > qClass.db
> > 
> > Administrator@TRAVIS /cygdrive/s/customer/dist10
> > $ cd ..
> > 
> > Administrator@TRAVIS /cygdrive/s/customer
> > $ ls -R *.db
> > ALPHACLS.db ALPHAGRD.db dist.db olddist.db
> > 
> > Administrator@TRAVIS /cygdrive/s/customer
> > $ ls *.db
> > ALPHACLS.db ALPHAGRD.db dist.db olddist.db
> > 
> > Your thoughts?
> > Travis Johnson
> > 
> 
> HTH
> 
> Don Sharp


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LS -R (Cygwin, latest builds as of 8/15/02, Win2K box)
  2002-08-21 10:38 My Avatar
@ 2002-08-21 11:57 ` Don Sharp
  2002-08-23 12:59   ` My Avatar
  0 siblings, 1 reply; 4+ messages in thread
From: Don Sharp @ 2002-08-21 11:57 UTC (permalink / raw)
  To: My Avatar; +Cc: gnuwin32

My Avatar wrote:
> 
> I've read all the FAQs, Groups, MsgBoards, & Cygwin
> archives I can find, and although I have found some
> user's with similiar problems, none of them ever
> seemed to be resolved (as far as I could tell).
> 
> My problem is this. I am trying to use the -R switch
> with ls to get a listing of files that I am going
> to send to sort (to get a top 10 kind of thing). I
> am very fearful that this is going to be flame bait,
> but feel I have done all I humanly can right now to
> resolve the issue on my own.
> 
> When I enter ls -R *.db, it only returns the matching
> files in the current path (and I verified that there
> are matching files in the subdirs).
> 

I think you are falling into the trap of thinking that -R will operate
on '.' as though it had been included in your argument list. Descent
into sub directories will only occur if the *.db expands into at least
one argument which is a directory, whereupon its sub directories will be
explored.

Note that it would list all the contents of such sub directories, it
wouldn't prepend the directory name to your *.db.

> Here is one thread that almost seems similiar, but
> doesnt seem to be resolved...
> http://www.cygwin.com/ml/cygwin/1999-08/msg00578.html
> ...when I try to do as the author suggests, I get the
> following messgage...
> $ find . -name *.db
> find: paths must precede expression
> Usage: find [path...] [expression]
> 
> ...so I tried...
> $ find /cygdrive/s/customer/ -name *.db
> find: paths must precede expression
> Usage: find [path...] [expression]
> 

This is because you should have put single quotes around the *.db

like
    find . -name '*.db'

to avoid shell expansion of the *.db

> Here is an example of what happens with LS...
> $ ls *.db
> Copy of Langdef.db RSINFO.db S98pcta.db langFltr.db
> qClass.db
> 
> Administrator@TRAVIS /cygdrive/s/customer/dist10
> $ cd ..
> 
> Administrator@TRAVIS /cygdrive/s/customer
> $ ls -R *.db
> ALPHACLS.db ALPHAGRD.db dist.db olddist.db
> 
> Administrator@TRAVIS /cygdrive/s/customer
> $ ls *.db
> ALPHACLS.db ALPHAGRD.db dist.db olddist.db
> 
> Your thoughts?
> Travis Johnson
> 

HTH

Don Sharp

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* LS -R (Cygwin, latest builds as of 8/15/02, Win2K box)
@ 2002-08-21 10:38 My Avatar
  2002-08-21 11:57 ` Don Sharp
  0 siblings, 1 reply; 4+ messages in thread
From: My Avatar @ 2002-08-21 10:38 UTC (permalink / raw)
  To: cygwin

I've read all the FAQs, Groups, MsgBoards, & Cygwin 
archives I can find, and although I have found some 
user's with similiar problems, none of them ever 
seemed to be resolved (as far as I could tell). 

My problem is this. I am trying to use the -R switch 
with ls to get a listing of files that I am going 
to send to sort (to get a top 10 kind of thing). I 
am very fearful that this is going to be flame bait, 
but feel I have done all I humanly can right now to 
resolve the issue on my own. 

When I enter ls -R *.db, it only returns the matching 
files in the current path (and I verified that there 
are matching files in the subdirs). 

Here is one thread that almost seems similiar, but 
doesnt seem to be resolved... 
http://www.cygwin.com/ml/cygwin/1999-08/msg00578.html 
...when I try to do as the author suggests, I get the 
following messgage... 
$ find . -name *.db 
find: paths must precede expression 
Usage: find [path...] [expression] 

...so I tried... 
$ find /cygdrive/s/customer/ -name *.db 
find: paths must precede expression 
Usage: find [path...] [expression] 

Here is an example of what happens with LS... 
$ ls *.db 
Copy of Langdef.db RSINFO.db S98pcta.db langFltr.db
qClass.db 

Administrator@TRAVIS /cygdrive/s/customer/dist10 
$ cd .. 

Administrator@TRAVIS /cygdrive/s/customer 
$ ls -R *.db 
ALPHACLS.db ALPHAGRD.db dist.db olddist.db 

Administrator@TRAVIS /cygdrive/s/customer 
$ ls *.db 
ALPHACLS.db ALPHAGRD.db dist.db olddist.db 

Your thoughts? 
Travis Johnson 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-23 16:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-21 11:15 LS -R (Cygwin, latest builds as of 8/15/02, Win2K box) Robb, Sam
  -- strict thread matches above, loose matches on Subject: below --
2002-08-21 10:38 My Avatar
2002-08-21 11:57 ` Don Sharp
2002-08-23 12:59   ` My Avatar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).