Answered by:
Is File Path longer than 260 characters allowed in .Net 2.0 ?

Question
-
In .net 1.1 I get a pathtoolongexception see here ....
"The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters."
from http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiopathclassgetfullpathtopic.asp
Are longer paths/filenames allowed in version 2.0 ???
There is an MS answer here
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=273165a2-e097-468c-baaf-ffd69acc33f7
But it is a bit vague as to when they will fix it.
Have they fixed it in the beta 2???
(I havn't got room/time to install VS2005 beta 2 to check myself)
Please let me know, thanks.
Answers
-
Ah just found this...
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=c054419a-1da7-4558-af80-11453d061bf2
Sounds like there is no fix available.
All replies
-
Ah just found this...
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=c054419a-1da7-4558-af80-11453d061bf2
Sounds like there is no fix available. -
Hello,
Ever got this error?
The specified path, file name, or both are too long. The fully qualified
file name must be less than 260 characters, and the directory name must be
less than 248 characters.
Since the .NET Framework does not support long filenames :-(
I had to write a library that calls the WIN32 API and wraps those functions
like System.IO.
I have a solution to your problem!
Delimon.Win32.IO replaces basic file functions of System.IO with long path
names support for characters up to 32,767 Characters
So bye bye MAX_PATH problem
A new version is available now:
- Added file/folder date changes
- Added attributes support
- Added Reading and Writing files
A Win32Explorer is also available that lets you access long filenames in
Windows
You can download my library here:
http://www.delimon.be -
Hey, I downloaded the DLL, nice work.
I ran into a bug
Directory.Exists(string);
if the string ends in a '\' it will return false.. like so
Directory.Exists("c:\mydir\") < will return false
Directory.Exists("c:\mydir") < will return true
It's not exactly how the System.IO works.
Thanks!- Edited by James D Cann Monday, October 20, 2008 5:50 PM
-
I also ran into the same issue. Thanks James for posting your findings. By the way, i can't seem to access this
http://www.delimon.be/
If you run into this problem and see that the Delimon library or similar since does not work, watch out for the condition where the individual subPath (those part of the path between the '\' character) that they must be less than 256 (lpMaximumComponentLength) characters long according to this: http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx
-
Hi i've got the same problem
can anyone help me? where can i dowload the library?
doesn't work...
-
Hi guys,
Sorry that it took so long but I have the Library avaiable again in this location
http://gallery.technet.microsoft.com/DelimonWin32IO-Library-17cc7893Not that i decided to stop sharing it but some years ago I lost everything, severe multiple disk crashes and unreadable CD/DVDs
Fortunately I found it again and decided to upload it to the Technet site.This is a .NET Library wirtten against .NET Framework 2.0 and can be used to
access very long folder and files from a .NET application.
http://gallery.technet.microsoft.com/DelimonWin32IO-Library-17cc7893
Since the .NET Framework does not support long filenames :-(
I had to write a library that calls the WIN32 API and wraps those
functions like System.IO. While it is not a complete replica of the
System.IO it does have most objects and functions available.Delimon.Win32.IO replaces basic file functions of System.IO
with long path names support for characters up to 32,767 Characters
So bye bye MAX_PATH problemDid you ever run into this problem?
System.IO.PathTooLongException
was unhandled. Message="The specified path, file name, or both are too
long. The fully qualified file name must be less than 260 characters, and the
directory name must be less than 248 characters."Grts,
Johan
- Belgian Unified Communications Community : http://www.pro-lync.be -
- Proposed as answer by Johan DelimonMVP Tuesday, March 13, 2012 12:59 AM
- Edited by Johan DelimonMVP Tuesday, March 13, 2012 1:05 AM
-
A new Library has been published to the Technet Gallery
http://gallery.technet.microsoft.com/DelimonWin32IO-Library-V40-7ff6b16cUpdates:
- This Library is compiled against the .NET Framework 4.0
- Fixed the minor bug about Directory.Exists() and the backslash at the end of the path name
Grts,
Johan- Belgian Unified Communications Community : http://www.pro-lync.be -
- Proposed as answer by Johan DelimonMVP Wednesday, April 4, 2012 11:38 PM