X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0	tests=AWL,BAYES_00,FREEMAIL_FROM,SPF_HELO_PASS,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: carolus <worwor@bellsouth.net>
Subject: Re: How to read thumb drive volume label
Date: Mon, 14 Mar 2011 12:04:36 -0500
Lines: 27
Message-ID: <illhr5$l71$1@dough.gmane.org>
References: <4D7E200C.40707@bellsouth.net> <0105D5C1E0353146B1B222348B0411A209DAA1008C@NIHMLBX02.nih.gov>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8
In-Reply-To: <0105D5C1E0353146B1B222348B0411A209DAA1008C@NIHMLBX02.nih.gov>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 3/14/2011 11:11 AM, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Charles Russell sent the following at Monday, March 14, 2011 10:03 AM
>> Is there some way to read the volume label on a USB flash drive?
>> Something like blkid in linux?
>
> Something like this?
>
> function label() {
>      $(cygpath --sysdir)/cmd /c dir ${1}:\\ | \
>          tr \\r \\n | \
>          sed -n -e '1s/^ Volume in drive . is //p'
>      }
>
> Or you could play with
>
> $(cygpath --sysdir)/label.exe
>
> Note that both require that one provides the drive letter.
>
> I hope this was not OT.  I apologize for use of tools that come
> with Windows, but sometimes I find native tools to be easiest.
>
> - Barry
>    Disclaimer: Statements made herein are not made on behalf of NIAID.
>
Thanks. I didn't realize that the output of dir depended on whether it 
was invoked from cygwin or from cmd, and I didn't know about label.exe.


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

