Using long filenames/UNC with System.IO

  • Thread starter Thread starter Tom Potts
  • Start date Start date
T

Tom Potts

I'm trying to create, move ,rename and delete etc some
files on a network device but System.IO cannot handle long
filenames. Any ideas anyone?
 
Tom said:
I'm trying to create, move ,rename and delete etc some
files on a network device but System.IO cannot handle long
filenames. Any ideas anyone?

You might want to try prepending the path with "\\?\". That should
extend the path to be up to 32000 characters.. If that does not work
with System.IO classes. You might want to use the Win32 APIs with
PInvoke (MoveFileEx, etc.)..
HTH
 
Long path names >260 just seem to bring everything down
about me.
\\?\UNC is rejected outright by IO.DirectoryInfo
and attemts to 'creep up' by using
DirectoryInfo.GetDirectories falls over one 260 char
exceeded.
I've tried putting wrappers on Scripting.FileSystemObject
and can create and delete long pathnames but cant
rename/move other than locally.
but no luck there either.
I've tried DllImport on msvcrt for _wrename but cant seem
to get that to work either!
 
\\?\UNC\ seems to upset a lot of methods
-----Original Message-----


You might want to try prepending the path with "\\?\". That should
extend the path to be up to 32000 characters.. If that does not work
with System.IO classes. You might want to use the Win32 APIs with
PInvoke (MoveFileEx, etc.)..
HTH
 
Now theres a supprise, yet another lacking feature on .NET :D

The .NET libraries have more gaps than swiss cheese.
 
Back
Top