0

I have a program that unzips downloaded files through DotNetZip when the download is finished. I get the save-path from a .txt-file, because it has to be extracted to a specific folder in a folder-system. There is one folder for files with no specific save-folder.
The program works well but sometimes I get an error message saying:

Part of the path could not be found!

bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) bei System.IO.Directory.InternalCreateDirectory(String fullPath, String path, DirectorySecurity dirSecurity) bei System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity) bei System.IO.Directory.CreateDirectory(String path) bei Ionic.Zip.ZipEntry.ValidateOutput(String basedir, Stream outstream, String& outFileName) bei Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password) bei Ionic.Zip.ZipEntry.Extract(String baseDirectory, ExtractExistingFileAction extractExistingFile) bei dvw002.Form1.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)

I don't know why this is happening, because 95% of the files get extracted normally, and the path exists...

asdasdad
  • 832
  • 3
  • 15
  • 27
  • 3
    You need to identify these "sometimes", get the stack trace and any exception that are thrown with the error messages associated with it and post it here for any of us to understand what is going wrong. – Ranhiru Jude Cooray Mar 27 '12 at 08:40
  • the error message is always the same, it's send to me via email... There is no specific file that is not extracted, I really can't tell what is the difference to the normally extracted files – asdasdad Mar 27 '12 at 08:44
  • 1
    You should extend your email to include the StackTrace of the exception. – Jehof Mar 27 '12 at 09:05
  • I posted the message... but I don't know what it means... – asdasdad Mar 27 '12 at 11:51

1 Answers1

1

Just a guess, but I sometimes get trouble with other zip programs when the extracted path exceeds the maximum length (it's suprisingly short).

Naming Files, Paths, and Namespaces on MSDN.

Alex KeySmith
  • 16,657
  • 11
  • 74
  • 152
  • Actually this was a problem at the beginning but i already fixed this by cutting the end of the path, so that foldernames (which were over 300 characters) have a maximum legth of 150 – asdasdad Mar 27 '12 at 09:34
  • Ok cool @user1286332, if your not already (but guessing from your comment you probably already are) it's also worthwhile double checking the total path length, as the depth of long folders can be a problem - not just each individual folder name. e.g. I always have problems saving into the project folder in my documents C:\Documents and Settings\Alex.Key\My Documents\Visual Studio 2010\Projects\ as the path is already really long before I even start extracting the stuff in the archives. – Alex KeySmith Mar 27 '12 at 10:24
  • This is what i did, the path to the file is about 80 chars, so if my file's name is maximum 150 chars long, it should be solved... and the specified file that is not extracted is actually just 30 chars long... I think it's not the problem... there were much longer filnames, extracted without problmes... – asdasdad Mar 27 '12 at 11:01