Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Exception while trying to unzip – ‘the filename is invalid’

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #20379 |
    Hi,
    While trying to unzip a zip file I’m getting an exception ArgumentException ‘The filename is invalid’
     inner exception: {“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.”}
     
    It is the case – I have a large file name in the zip.
    Is there a way to work around this issue?
     
    The code:
     
                AbstractFile zipFile = new DiskFile(zip_file);
                ZipEvents events = CreateZipEvents();
                ZipArchive archive = new ZipArchive(zipFile);
                // “copy from a zip archive”.
                AbstractFolder dest = new DiskFolder(target_dir);
                archive.CopyFilesTo(events, null, dest, true, true);
     
     
    I’m using Xceed zip 4.0
     

    Imported from legacy forums. Posted by Eli (had 1016 views)

    User (Old forums)
    Member
    Post count: 23064

    Eli,

    You could probably extract out the files using the ZipReader class, and in the cases where you throw Path Too Long exceptions just write to a FileStream using some short arbitrary file name.  At least then you’d have the data out.

    Imported from legacy forums. Posted by Steve (had 954 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.