 |
|
 |
Hello,
Hello, I like your way of doing unzip with Shell32. I followed it however, I am getting " The system cannot find the file specified" error at the shell.NameSpace(sourceZipFile). I have the Shell32.dll reference. I also have the Interop.shell32.dll in my both bin/debug and obj/debug. Is there way that you can shed some lights on this? I know many people on the internet made what you suggested work. some how it failed on me, my colleague got the same problem too. I think it is the environment that cause the problem, is there any place that I need to check for my environment?
-Rick
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
If you look through the rest of the posts below you will see other people that had similar issues and how they were resolved.
There could be many reasons why you are getting the error you are getting.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
when i debug this sample i got an error like "Object reference not set to an instance of an object." highlight section on the FolderItems items = SrcFlder.Items(); code. whats that and what should i do to fix that problem please help
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
That probably means that SrcFlder is equal to NULL... so the path provided when getting SrcFlder is probably incorrect.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
wow thanks for super fast reply but im sure it is not null because i put there a zip(compressed) file.
also i have another question that the code for click event handler next to shell method, what exactly am i going to text to txtSource and txtDestination textboxes? thanks for your help
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
If I were you I would put a break on that line of code in Visual Studio and see for sure if it is NULL... it is the only object in that line of code and the error you described always means that a variable that is supposed to hold a live object is infact NULL.
It has been a while since I wrote this code so I might be off a little here, but those textboxes are probably supposed to hold the paths to the source zip file and the destination zip file.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hmm but although i wrote the zip file path to txtSource and the destination path where zipped file will be extracted to , i didnt worked and this code is vital for my project my zip file pathSource="c:/Users/secretyavuz/Desktop/hadi/oglenDeneme.zip"; my dest file path, it should be extracted to this specific folder : pathDestination="c:/Users/secretyavuz/Desktop/hadi"; and also there should be no UI during compress. thanks for your great helps..
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Your slashes are pointing in the wrong direction... it should be:
c:\Users\secretyavuz\desktop\hadi\oglenDeneme.zip
Other than this I dont know what the problem might be. If you read through the others that have posted on this article you should see issues people were having and what resolved them. This might help you get your project completed.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Is there a way to unzip a file which does not have a specific .zip extension ? I've tried your code, and it works if my file as a .zip extension, but doesn't if it's something else, like ".z00" ....
Thanks for sharing your code by the way, it's appreciated 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
My guess is that the answer in general is no. This is because my code relys on the Windows zipping functionality which uses extensions to recognize zip "folders"... however you could modify my code so it temporarily changes the extension to .zip and then back again when done.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hello:
I'm trying to understand why the following call results in a null value: Shell32.Folder DestFlder = sc.NameSpace(dest); where dest = "C:\Documents and Settings\andrea.washington\My Documents\Visual Studio 2008\Projects\HorizonReportResend\bin\Debug\horizonResend"
Yes the folder does exist and yes I have put quotation marks around the path. I tried using the sample app thinking it was my code but the same thing happens using the sample app. I have tried putting the horizonResend folder in different spots under C:\Documents and Settings but still get a file not found message. The call works fine if the horizonResend folder is on the root of C (C:\horizonResend).
Any ideas??
Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I created the exact path you mentioned and used this code which did not result in a null... see if this works...
Shell32.ShellClass sc = new Shell32.ShellClass(); Shell32.Folder SrcFlder = sc.NameSpace(@"C:\Documents and Settings\andrea.washington\My Documents\Visual Studio 2008\Projects\HorizonReportResend\bin\Debug\horizonResend");
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Any tips on debugging this when something goes wrong? I wrapped this up in an assembly, and am using this in a web application to zip and stream files to the user. Everything works great on my dev machine, however when I deploy it to a test machine, it creates the ZIP folder, but never adds any files to it, and finally just times out.
I've verified the file paths are correct, the IIS user it runs under has read/write permissions on the folder, and I'm pretty much stuck at this point trying to figure out what I'm doing wrong.
Any help would be appreciated.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
I would make it print out a trace after each line of code into a text file and then look at that text file after a failure. This might tell you which line of code is the problem. You might also try wrapping the code in a try catch and writing out the error message if any as well. I have not seen the decompress fail myself so no real life tips to give.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, I am using sample code and run this project and select the source path and destination path and zip file name but whenever i click the zip button it gives the error (The system cannot find the file specified)win32 exception was unhandled. pls help to run this code successfully. Amit Saxena
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi, 1) Is there a hack or a straight forward way to ignore the subfolders within the archive and decompress them in the same directory? For example instead of decompressing in "C:\Temp\DecompressedFilesHere", it should decompress in C:\Temp
2) Can this method be used to decompress the files from a .tar archive ?
Thank you.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Unfortunately I believe the answer to both your questions is no. This method uses the zip functionality built into Windows and I have never seen Windows zip ability used with tar files.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
 |
Hi,
First of all thanks for your code - it works great. But i have a requirement where i have to decompress password protected zip file. Any idea how to go about it?
Regards, Venkatesh.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thanks for the complement. I will think about it some more, however right now I would have to guess this is not possible since the Windows Shell API does not allow you to set a password when ziping a file. So I would also guess that it cannot supply a password when decompressing. If I find a solution I will post it by this weekend.
-- modified at 22:26 Thursday 22nd February, 2007
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
 |
this line is used to compress a folder and it works:
new ShellClass().NameSpace(file).CopyHere(new ShellClass().NameSpace(folder).Items(), 20);
this line is used to decompress a file and it doesnt work:
new ShellClass().NameSpace(folder).CopyHere(new ShellClass().NameSpace(file).Items(), 20);
it is the same as what is in your tutorial but in one line. it should work. but it doesnt.
the compressing code line results in a zip file that works fine. the decompressing code line results in removing all files in the zip file and extracting nothing.
|
| Sign In·View Thread·PermaLink | 2.00/5 (3 votes) |
|
|
|
 |
|
 |
I am having a problem when I run this on Win2K advanced server. Are the shell api's supported on this platform?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |