delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/08/21:12:38

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 8 Sep 2005 21:12:23 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Matthew Movafaghi <mattmova AT hotmail DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Simple find command does not work for * .html
In-Reply-To: <BAY104-F29381636740A8DA88929E4D6980@phx.gbl>
Message-ID: <Pine.GSO.4.63.0509082018340.11417@slinky.cs.nyu.edu>
References: <BAY104-F29381636740A8DA88929E4D6980 AT phx DOT gbl>
MIME-Version: 1.0

Ugh, top-posting...  Reformatted.

On Fri, 9 Sep 2005, Matthew Movafaghi wrote:

> > From: ericblake AT XXXXXXX DOT XXX (Eric Blake)
> > To: Matthew Movafaghi <mattmova AT XXXXXXX DOT XXX>, cygwin AT XXXXXX DOT 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 AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019