delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/29/23:18:02

X-Spam-Check-By: sourceware.org
Date: Sun, 29 Oct 2006 23:17:35 -0500 (EST)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Lloyd Zusman <ljz AT asfast DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Changing Windows "hidden" and "system" attributes?
In-Reply-To: <loom.20061029T225001-758@post.gmane.org>
Message-ID: <Pine.GSO.4.63.0610292309540.22731@access1.cims.nyu.edu>
References: <loom DOT 20061029T225001-758 AT post DOT gmane DOT org>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Sun, 29 Oct 2006, Lloyd Zusman wrote:

> Igor Peshansky <pechtcha <at> cs.nyu.edu> writes:
> >
> > On Sat, 28 Oct 2006, Lloyd Zusman wrote:
> >
> > > Well, for one thing, things like this don't work:
> > >   find . -type f -print | xargs attrib
> >
> > find . -type f -print | cygpath -w -f- | xargs attrib
> >
> > Won't work with -print0, but you get the idea.
> > 	Igor
>
> Thank you.  I've tried this, and the -L1 argument is needed
> with xargs.  But even with that, the pathnames get screwed
> up for subdirectories ...
> [snip]
>   $ pwd
>   /home/me
>   $ cygpath -w `pwd`
>   e:\home\me
>   $ find . -type f -print | cygpath -w -f- | xargs -L1 attrib
>   A          E:\home\me\.bash_history
>   A          E:\home\me\.cvspass
>   File not found - .elinksbookmarks
>   File not found - .elinkscookies
>   File not found - .elinkselinks.conf
>   File not found - .elinksglobhist
>   File not found - .elinksgotohist
>   A          E:\home\me\.emacs
>   File not found - .fluxboxfbrun_history
>   ... etc. ...
>
> Because of cygpath, filenames such as .elinks/bookmarks and
> .fluxbox/fbrun_history are passed to xargs like this:
> .elinks\bookmarks and .fluxbox\fbrun_history.
>
> Then xargs invokes attrib via a subshell, and therefore,
> shell meta-character handling is performed. That causes
> the backslashes in those path names to be removed before
> they get passed to the attrib command, thereby causing
> that program to see incorrect file names.

Indeed.  So how about using the "-m" option of cygpath, instead of the
"-w"?  FWICS, attrib will happily understand "/"-delimited filenames.

> Because of this, a hacky wrapper script for attrib like the
> one I wrote in my earlier message is still needed, unfortunately.

I had no problem running your test with "cygpath -m".
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

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