delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/30/11:47:30

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Matthew Woehlke <mwoehlke AT tibco DOT com>
Subject: Re: Changing Windows "hidden" and "system" attributes?
Date: Mon, 30 Oct 2006 10:29:11 -0600
Lines: 28
Message-ID: <ei598o$hl3$1@sea.gmane.org>
References: <loom DOT 20061026T132712-881 AT post DOT gmane DOT org> <ehqsbl$dpe$1 AT sea DOT gmane DOT org> <loom DOT 20061027T131039-458 AT post DOT gmane DOT org> <eht7p9$ujt$1 AT sea DOT gmane DOT org> <loom DOT 20061028T031119-796 AT post DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0
In-Reply-To: <loom.20061028T031119-796@post.gmane.org>
X-IsSubscribed: yes
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

Lloyd Zusman wrote:
> Thorsten Kampe <thorsten <at> thorstenkampe.de> writes:
> 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.
> 
> P.S. -- Here's my script.  I call it "cattrib" (I'm posting via gmane,
> so forgive me if the indentation is screwed up):
> [snip script]

You could probably make this even more transparent by dropping a symlink 
'attrib' to this somewhere high in $PATH (or renaming it, but the 
symlink lets 'cattrib' force calling the script even if the Windows 
'attrib' is higher in PATH) and having the script call 'attrib.exe' 
(which won't pick up the script).

Also, if you want it to be *really* transparent, you should be 'cut -c 
12-'ing the output of attrib and then appending the original arg before 
its trip through cygpath, otherwise you potentially mangle things due to 
symlinks, mount points, etc.

i.e. something like this:
echo "$(attrib.exe $(cygpath -w "${arg}") | cut -c 12-)${arg}"

-- 
Matthew
This message will self destruct in ten centuries.


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