Question

I am facing a issue in my code. PFA my code below

// Extract Zip File
public static void Extract(string zipFileName, string destinationPath)
{
    ZipFile zipfile = new ZipFile(zipFileName);      
    List<ZipEntry> zipFiles= GetZipFiles(zipfile);

    foreach (ZipEntry zipFile in zipFiles)
    {
        if (!zipFile.isDirectory())
        {
            java.io.InputStream s=zipfile.getInputStream(zipFile);
            //InputStream s = zipfile.getInputStream(zipFile);

            try 
            {
                Directory.CreateDirectory(destinationPath + "\\"  + Path.GetDirectoryName(zipFile.getName()));
                // Directory.CreateDirectory(destinationPath + "\ + Path.GetDirectoryName(zipFile.getName()));

                //Directory.CreateDirectory(Path.GetDirectoryName(zipFile.getName()));
                java.io.FileOutputStream dest = new java.io.FileOutputStream(Path.Combine(destinationPath + "\\" + Path.GetDirectoryName(zipFile.getName()), 
                //java.io.FileOutputStream dest = new java.io.FileOutputStream(Path.Combine(Path.GetDirectoryName(zipFile.getName()), 
                Path.GetFileName(zipFile.getName()))); 
                try
                {
                    int len = 0;
                    byte[] buffer = new  byte[7168];
                    while ((len = s.read(buffer))  >= 0)
                    {
                        dest.write(buffer, 0, len);
                    }
                }
                finally
                {
                    dest.close();
                }
            }
            finally
            {
                s.close();
            }
        }
    }
}

Issue is : In this class can any one tell me formatof "string zipFileName, string destinationPath " means : which pathformate be use in zipFileName and designationPath.

This code is used for Unzip file using J# in c# please help me as soon as possible

: here zipFilename is path file to be ziped and destinationPath is path where file to be unzipped.

No correct solution

OTHER TIPS

If I understand your question correctly, and you're working on Windows, then you would probably use a format like:

Extract(@"c:\myfolder\mysubfolder\myfile.zip", @"c:\mydestinationfolder\mysubfolder");

Give it a try and leave a comment to let me know if it works, or whatever else you've tried previously.

Are you using any compression libraries . For example the ZipFile - Is this any third party library ?

You can check compression libraries for C# that are available incase you plan to implement it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top