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