DOS <-> Unix filenames

Roger René Kommer kommer@artefaktur.com
Sun Jan 31 23:52:00 GMT 1999


Hi,

I like to instrument bash, sed, etc. to manage my NT Server.

A common problem is, that in scripts that uses gygwin and NT command
line utilities I have to covert the filenames from NT to cygwin
and vice versa.

Sample:

//e/d/cxx/aproject <-> e:\d\cxx\aproject
/usr/local/myfiles <-> d:\unixfs\usr\local\myfiles
/cdrom/x/file      <-> x:\file
./dir/output       <-> .\dir\output

What I need is a (two) utilities which can convert these filenames
ufn2dfn [u]nix[f]ile[n]ame2[d]os[f]ile[n]ame
and
dfn2ufn [d]os[f]ile[n]ame2[u]nix[f]ile[n]ame

ufilelist="//e/d/cxx/aproject /usr/local/myfiles /cdrom/x/file ./dir/output"
for i in $ufilelist; do
	a_ntutility `ufn2dfn "$i"`
done

dfn2ufn is quite simple and can done with a few sed calls.
ufn2dfn is a little more complicated, because it has to evaluate the mount
table.

If I didn't overlook a simpler solution I would suggest to integrate this
into the cygwin package. Alternatively it can be integrated into the ls or
mount command.

With RFC and regards,
Roger Rene Kommer
kommer@artefaktur.com






-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list