This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simple find command does not work for * .html


Ugh, top-posting...  Reformatted.

On Fri, 9 Sep 2005, Matthew Movafaghi wrote:

> > From: ericblake@XXXXXXX.XXX (Eric Blake)
> > To: Matthew Movafaghi <mattmova@XXXXXXX.XXX>, cygwin@XXXXXX.XXX

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > [snip FULL HEADERS]

Umm, and there was no need to quote the full message headers, either.

> > > For some reason the following find command will not complete for *.html.
> > >
> > > It says: find: paths must precede expression....
> >
> > User error.  Remember that the shell does filename globbing before
> > find ever sees its input (unless you have done set -f in a POSIX shell).
> > If the current directory contains .html files, then you really are
> > causing a syntax error.
> >
> > > `find d:\ -type f -perm -u+w -name *.properties`
> >
> > Try 'echo find d:\ -type f -perm -u+w -name *.html' to see what you
> > were really doing, then try
> > 'find d:\ -type f -perm -u+w -name \*.html'

You must've been in a cmd.exe shell if this worked for you.  In a POSIX
shell, you'd need to use

find 'd:\' -type f -perm -u+w -name \*.html

(otherwise "d:\ -type" would be interpreted as one argument with the value
"d: type")

> > to fix it.  And while you are at it, since this is cygwin, try
> > 'find /cygdrive/d -type f -perm -u+w -name \*.html'
> > to get rid of that pesky backslash (are you in a cmd.com shell,
> > explaining why you didn't quote it properly?) and behave more
> > unixy.
>
> It was user error... of course.  Thanks for the fix.
> I was just trying to find all writiable files of certain types.
>
> However, the command
> 'find /cygdrive/d -type f -perm -u+w -name \*.html' will sometimes not
> find a writable file when windows thinks that it is.  When viewed with
> ls -l, the file doe not look writable, but when viewed with dir *.html
> /A-r /S from a cmd prompt the file shows up.
>
> Any thoughts?

First off, "dir *.html /A-r" will *not* find all writable files -- it will
find all files with no "read-only" attribute set (not the same thing).

Secondly, access to objects in Windows NT-based systems (NT, 2k, XP) is
controlled by ACLs, or "access control lists".  Cygwin tries to map those
into POSIX permissions, but a perfect mapping is not always possible.
For details on how this mapping works, read the "ntsec" section of the
User's Guide.

The short answer is, if "ls -l" shows the file as writable, "find -perm
-u+w" will find it, otherwise it won't.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]