Pergunta

using (ZipFile zip = ZipFile.Read("update.zip"))
{
   zip.ExtractAll("\\serv\\www", ExtractExistingFileAction.OverwriteSilently);
}

I'm using the above to attempt to extract update.zip into \serv\www. No errors are thrown and no exceptions are caught when I enclose it in a try{} catch{}. In case it is of any relevance the structure of update.zip is:

update.zip:
    folderA
        ONE.txt
        TWO.txt

\serv\www has folderA with several files in it.

When running my program it appears as though the extraction is successful, however the files just don't appear anywhere. What can be causing this?

Foi útil?

Solução

Is is better to include a hard drive letter as well.

c:\server\www

I tested it without that and it works. It just did the same as when I included "c:". But I don't know if there is a deterministic behaviour in it. Try to look for unziped folder in the root of the hard drive partition you have stored your project on.

EDIT:

I consulted with the DotNetZip spec and they mention that you can provide just a relative path.

Extracts all of the items in the zip archive, to the specified path in the filesystem. The path can be relative or fully-qualified.

But they do not mention where will appear unpacked files if you do. My guess is in the first part of the answer. I have my testing project stored on C:/Users/... and unpacked files appeared directly in the root of C:.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top