The Win32 API GetLongPathName() is not avail. on NT4 ... Quote MSDN for !? GetShortPathName ?! : "Alternatively, where GetLongPathName is not available, you can call FindFirstFile on each component of the path to get the corresponding long name."
it seems .NET Directory.GetFiles, Directory.GetDirectories, Directory.GetFileSystemEntries do use FindFirstFile. so I used this hack warning: only full absolute path with drive, no UNC, no error testing, implementation depending, ... use at your own risk. // =============== only for long file name ================= string spath = @"D:\LONGDI~1\LONGSU~1\LONGFI~1.TXT"; string dir = Path.GetDirectoryName( spath ); string name = Path.GetFileName( spath ); string[] npath = Directory.GetFiles( dir, name ); name = Path.GetFileName( npath[0] ); name : LongFileName.txt // ========================================================== // =============== full long path ================= string spath = @"D:\LONGDI~1\LONGSU~1\LONGFI~1.TXT"; string[] elm = spath.Split( new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar} ); string lpath = elm[0] + Path.DirectorySeparatorChar; for( int p = 1; p < elm.Length; p++ ) { string[] npath = Directory.GetFileSystemEntries( lpath, elm[p] ); lpath = npath[0]; } lpath : D:\LongDirectoryName\LongSubDirectory\LongFileName.txt // ========================================================== there is also a method using the shell interfaces... Thomas > -----Original Message----- > On Behalf Of Michael Anderson (Compliance Technology) > Sent: Thursday, May 30, 2002 23:36 > Subject: ShortPath to LongPath how? > I've looked at the System.IO.Path, System.IO.FileInfo, and > various other > System.IO classes and cannot find any way to convert a short > path into a > long path. Is there a method somewhere in C# to do this? You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.