winpath2unix

NAME

winpath2unix, unixpath2win - convert path-name formats

SYNOPSIS

winpath2unix [-n] winpathname
unixpath2win [-s] interixpathname

DESCRIPTION

The winpath2unix(1) and unixpath2win(1) utilities convert the format of a specified path name between the Interix format (such as /dev/fs/F/Cat/dog, here referred to as interixpathname) and the Windows format (such as F:\Cat\dog, here referred to as winpathname). The converted path name is written to standard output.

The winpathname need not be an existing file. If possible, however, the utility will find the longest prefix of the Windows path name that names an existing file which is accessible to the effective user, and it will convert that prefix to canonical case. This conversion is necessary because Windows path name lookups are case insensitive, while Interix path name lookups are case sensitive.

The winpath2unix(1) utility can take a single option:

-n
Interpret winpathname as a "nonstrict" path. Convert syntactically incorrect Windows path names to /?untranslated?bad path name. Do not attempt to find the correct case of winpathname. Do not generate an error message for a zero length winpathname, that is, a path name such as "". See EXAMPLES.

The interixpathname is not required to name an existing file. The unixpath2win utility will find the longest prefix of the Interix path that names an existing file and which is accessible to the effective user, and it will resolve symbolic links within this prefix.

The unixpath2win(1) utility can take a single option:

-s
If interixpathname names an existing symbolic link file, then the symbolic link named by interixpathname will not be followed, although symbolic links named by prefixes of interixpathname will still be followed. For example, if /C is a symbolic link that points to C:\, and Windows Services for UNIX is installed in C:\SFU, then

As a special case for both utilities, the Interix path name /dev/null is translated to the Windows path name "nul". Support for other device names will be added in the future.

Both utilities just perform a syntax conversion of the input string to produce the output string. No attempt is made to verify the validity of either path. Consequently, if the input string specifies a badly formed or illegal path (such as C:\:) or a path that cannot be represented in the target file system (such as /dev/fs/C/..), the output path will not be usable.

DIAGNOSTICS

The winpath2unix(1) and unixpath2win(1) utilities exit with status 0 for success, and >0 if an error occurred.

EXAMPLES

Below are examples of path name conversions. They assume that you are in an Interix shell and that your current directory is /dev/fs/C/temp, which in Windows format is C:\temp. Also, the examples assume that you installed Windows Services for UNIX into the C:\SFU directory.

The Interix root directory is the installation directory into which you installed Windows Services for UNIX. In the example below, / converts to C:\SFU.

$ unixpath2win /
C:\SFU

Any ".." processing is done to the UNIX path name first; the result is then converted to Windows format, as displayed below.

$ pwd 
/dev/fs/C/SFU/
$ unixpath2win ..
C:\

An error results if, after the UNIX path is processed, the result is not a legal Windows path, as shown.

$ pwd
/dev/fs/C/temp
$ unixpath2win ..
C:\
$ unixpath2win ../..
../..: Can't map pathname to Windows namespace

A winpathname such as "C:temp" will be interpreted as if it were "C:\temp". The back slash (\) is then converted to a forward slash (/).

$ winpath2unix c:temp
/dev/fs/C/temp

The -n option on winpath2unix(1) does not translate certain arguments. In the example below, because //temp// is syntactically incorrect, the -n option causes winpath2unix(1) not to translate //temp//.

$ winpath2unix //temp//
//temp//: No such file or directory
$ winpath2unix -n //temp//
/?untranslated?//temp//

The following example assumes that you have a /Perl directory. Without the -n option, the winpath2unix(1) utility capitalizes the letter "P"; with the -n option, the winpath2unix(1) utility does not perform a case conversion.

$ winpath2unix perl
Perl
$ winpath2unix -n perl
perl

SEE ALSO

unixpath2win(2)

winpath2unix(2)