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: Changing Windows "hidden" and "system" attributes?

Igor Peshansky <pechtcha <at>> writes:
> On Sat, 28 Oct 2006, Lloyd Zusman wrote:
> > Well, for one thing, things like this don't work:
> >and this is what
> >   find . -type f -print | xargs attrib
> >
> > Yes, I know that I could put a wrapper script around attrib to apply
> > cygpath to the argument, to name but one of several ways to solve this.
> > In fact, I have already done this, thereby making my own
> > cygwin-compliant analog to 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 ...

  $ pwd
  $ cygpath -w `pwd`
  $ 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.

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

 Lloyd Zusman
 Lloyd Zusman

Unsubscribe info:
Problem reports:

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