Path to file longer than 255 characters

Apr 20, 2009 at 6:53 PM
Cheeso, long time no talk - that's good it means no issues! But since I'm posting, well, it's not too bad...
Using -
I have a very minor issue where an error is thrown on a severly nested file many folder layers deep. Meaning the file that is trying to be included in the archive is nested within a folder, within a folder, within a...(repeat 10 times). The path to the file being archived exceeds the allowed number of characters, I thought it said 255 but might be 250(?).
Anyway, I was able to help the user by finding the problem folders and help her reorganize them to something more realistic, but wondered if you (a) have encountered this, or (b) have fixed this since

And with the 32nd pick in the 2009 draft, the Pittsburgh Steelers select......Percy Harvin, WR, Florida.
Apr 22, 2009 at 3:01 PM
Hey Jeff!

Hmm, that problem has been neither reported nor fixed.
I think it is a result of some confusion on my part.  In the old days, Windows had a MAXPATH constant that described the maximum number of characters in a path.  It was 260.  I used that constant without thinking about it too much, to limit the length of the path.  I now realize that limit has been lifted in Windows.  I'll need to fix that.

About the Steelers drafting a WR: right on, but which one? The Steelers staff often surprises with their picks!
Apr 22, 2009 at 3:40 PM
Let me know when you have a new release and I'll try it.

Harvin, will be there, but he has a lot of red flags - poor route running, pot smoking, character concerns, etc.. Some mocks have them taking a center, but I think they go WR.
Apr 26, 2009 at 4:02 PM

I'm facing the same problem - the path or the file name is too long (>260 or >248 characters).
Is there any workaround? I cannot re-organize the structure of files or rename files.

Thank you
Apr 28, 2009 at 5:22 PM
No current workaround.
The workitem is:
Apr 29, 2009 at 11:10 PM
Ok, I've done some research on the problem.  It turns out that long pathnames are not well supported by the .NET base class library (BCL).
I'm inclined to defer any efforts to fix this, in lieu of a REAL fix from Microsoft in the BCL and Win32.
Apr 30, 2009 at 12:23 PM
Ok for me - it's a rare issue anyway.

And Ziggy Hood? Not what I was expecting from the Steelers, but not a bad choice either.
Apr 30, 2009 at 3:07 PM
I was reading an article in the Pgh Post-Gazette this morning by Gene Collier, a funny guy who can write.
His view was, all the attention on the draft is so misplaced. It takes 5 years to determine whether you had a good draft.
Then he did a retrospective on the Steelers' 2004 draft. They picked a bunch of bums, and guy named Roethlisberger. Turns out that was a good draft.

I looked into the PathTooLongException, and there are numerous places within the library where I'd have to take special action to handle the long paths.
Considering that neither Windows Explorer nor the CMD.exe prompt can support long paths..., it seems like a problem that ought to be solved in the OS, rather than in the ZIP library. 
Aug 3, 2011 at 2:06 PM

Hey Cheeso,

first things first, dotNetZip is awesome. I recently implemented a backup & restore function. Works like charm.

When debugging the code I also encountered the PathTooLongException, using ZipFile.AddDirectory() to save a zip. Problem here, the resulting exception doesn't even say which path was to long or whatever. Using the DotNetZip devkit I saw this happened in ZipEntry.Create when File (Directory) will be first accessed with File.GetLastWriteTime(filename) (line 2402). Well, the path really was too long :).

On the other hand two functions in dotNetZip could be helpfull.

1. throw custom Exception that actually tells you the path.

2. A flag like IgnoreInvalidPaths (perhaps combined with an event InvalidPathEncountered) could help scenarious were you just want to zip what you get out of a directory. 

Just a suggestion. Thx again, saved me tons of time.

Aug 3, 2011 at 2:39 PM

thanks for the compliments.  one thing: please don't resurrect 2-year old threads with new information. If you post this to a new thread I'll give you a real response.