Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
static void Main(string[] args)
       {
           var fileDirPath = new DirectoryInfo(@"C:\7compressNigol");
           FileInfo[] Files = fileDirPath.GetFiles("*.*");
           //var prefferedPath = @"C:\7compressNigol\123.zip";
           List<string> filesToZip = new List<string>();
           foreach (FileInfo file in Files)
           {
               ProcessStartInfo p = new ProcessStartInfo();
               p.FileName = @"C:\7compressNigol\7z.exe";
               //p.Arguments = "a /d \"" + prefferedPath + "\" \"" + fileDirPath + "\"";
               p.Arguments = "a \"" + file + "\" \"";
               p.WindowStyle = ProcessWindowStyle.Hidden;
               Process x = Process.Start(p);
               x.WaitForExit();
               return;
           }
       }


What I have tried:

I'm using 7z.exe to compress huge folders that contain in a directory, so how to edit my code, I want it compress each folder with same name?
Posted
Comments
Mehdi Gholam 31-May-16 4:25am    
You will have to explain more about what you mean.
Nigol_Learner 1-Jun-16 21:57pm    
There is a lots of folders in one directory, so I want to compress each folder with same name not with newly rename.

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