Click here to Skip to main content
15,886,786 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Dear All,

I want to copy a file from zipped folder and put in a destination folder. I am using VS2012 .net framework 4.5. I have looked at DotnetZip but it doesn't help me. my code is below. It is working for unzip folder but not working for zipped folder. how can I do that. please help me. It's very urgent. Thanks in Advance

public static void Main(string[] args)
{
File.Copy("C:\\C#CodeExample\\TDPOC\\ABC.zip\\AUDIT.LOG, C:\\C#CodeExample\\TDPOC\\NewLogFile\\MyNewLogFile.LOG);

}
Posted
Updated 25-Aug-14 5:57am
v2
Comments
Sergey Alexandrovich Kryukov 25-Aug-14 12:01pm    
"it does not help me" is not informative and makes no sense. You are the one who is not helping yourself.
—SA
PhilLenoir 25-Aug-14 12:05pm    
You can use the SHELL32 API. The Shell object recognises zip folders. The CopyHere and MoveHere methods are asynchronous, so multiple calls for the same zip folder may find the zip file locked but no error is returned to the calling application. Multiple calls require a delay. Multiple files using wildcards in one call are synchronous (sequential) so this doesn't apply.

1 solution

The line of code shown in your post makes no sense at all, this part: "ABC.zip\\AUDIT.LOG". Who told you that a path can go continue into the zip file? Read DotNetZip documentation and use the product the intended way, not the way your fantasy tells you:
http://dotnetzip.codeplex.com/documentation[^].

—SA
 
Share this answer
 
v3
Comments
[no name] 25-Aug-14 12:14pm    
If you don't wanna help that's okay but don't criticize. It's showing your mentality and which family you come from. @SA
Sergey Alexandrovich Kryukov 25-Aug-14 12:28pm    
I wish I was such a formidable vision :-).

Anyway, the idea to discuss your views of personal quality of members is absolutely unacceptable here,
and your advice on what to post and what not contradicts to the whole idea of knowledge and learning. Besides, it is not clear why do you think you are more free than other people. You think you have the rights ask whatever you want and even break the basic rules of the forums, and, at the same time, you deny the rights of others to criticize you, which is done, by the way, only to help you. Set aside the fact that you fail no notice the help you receive.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900