Feroz Khan

Feroz Khan

  • 1.4k
  • 292
  • 86.1k

Extract .zip file From folder

Jun 10 2018 9:27 AM
Hi,
 
I want extract .zip file from filder and rename inside zip file.
 
i am using below code for extract and its working also but how can i rename inside file.
  1. if (ofd.ShowDialog() == DialogResult.OK)  
  2. {  
  3. Path_List.Items.Clear();  
  4. foreach (String file in ofd.FileNames)  
  5. {  
  6. if ((mystream = ofd.OpenFile()) != null//have tried using Stream in different ways to no avail  
  7. {  
  8. using (mystream)  
  9. {  
  10. // populates text box with selected filenames ????? lists only 1 filename  
  11. Path_List.Items.Add(file);  
  12. txt_File_Count.Text = Path_List.Items.Count.ToString();  
  13. ZipFile zipFile = new ZipFile(file);  
  14. string fullPath = ofd.FileName;  
  15. string filename = ofd.SafeFileName;  
  16. string path = fullPath.Replace(filename, "");  
  17. zipFile.ExtractAll(path, ExtractExistingFileAction.DoNotOverwrite);  
  18. zipFile.ExtractAll(Application.StartupPath);  
  19. }  
  20. }  
  21. }  
  22. Path_List.Items.Clear();  
  23. }  

Answers (2)