ls -R doesn't work; V1.3.12 on Win2000

Randall R Schulz rrschulz@cris.com
Sat Jul 6 08:23:00 GMT 2002


Hari,

What are you trying to do, exactly? Unless there's problem local to your 
system, "ls" and its "-R" option work just fine--I use them all the time, 
as do many others. Your description of the "symptoms" suggest that your 
"ls" and related Cygwin facilities are working correctly.


Here's what you're command is asking the software to do: List all the file 
system entities in the current directory whose names end in ".doc". For all 
such entities that happend to be directories, also list their content 
recursively. Include "hidden" entries (those whose name starts with ".") in 
the listing and produce a "long" style listing.


If you want to list all the files within a sub-hierarchy of the file system 
that meet some criteria (name patterns, e.g.) you must involve the "find" 
command. So, here's a shot at what you want:

         ls -ld $(find -iname "*.doc")

If you're not using BASH, use this syntax instead:

         ls -ld `find -iname "*.doc"`


If you want both ".doc" and ".pdf" files, this will work:

         ls -ld $(find -iname "*.doc" -o -iname "*.pdf")


If there are very many files (technically, if the number of characters of 
output produced by "find" exceeds a built-in limit), this will fail and 
you'll need to use the "xargs" command to overcome that limitation.

Find is very sophisticated and can select files based on many criteria in 
arbitrary combinations. For example, it can find files based on regular 
expressions, too (the patterns used in the "-name" and "-iname" are shell 
"glob" expressions, not regular expressions). Read the man page.


If I misunderstand your intent, please forgive me and let me know what it 
was you're attempting.


Randall Schulz
Mountain View, CA USA


At 12:14 2002-07-05, Hari Turlapati wrote:
>The command "ls -laR *.doc" (Recursive listing of *.doc or *.pdf or
>*.rtf, in general files with specific extension) under a subdirectory to
>/cygdrive/c/ doesn't work. Even "ls -laR *.*" doesn't work.
>
>But "ls -laR *" lists all the files under the subdirectories.
>
>I am using CygWin Release 1.3.12-1 on Win2000 OS. The command "uname -a"
>on my machine prints out the following:
>
>CYGWIN_NT-5.0 HariPC 1.3.12(0.54/3/2) 2002-07-03 16:42 i686 unknown
>
>Thanks
>
>Hari


--
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/



More information about the Cygwin mailing list