Compressing several files to the same zip file output!

  • Thread starter Thread starter Jens Jensen
  • Start date Start date
J

Jens Jensen

Hello,
I use the code below to zip files to a single .zip destination. I get the
expected result when i work on my developement machine (WinXP sp.2).

When i deploy the web application which host the code on win2k3 , it only
works for a single file.

I gave the modify right to "Noetwork Service" on the folder i'm writing to.
It does not help.

Can someone tell me what i'm doing wrong?


Thanks
JJ
Code below:


protected void ZipWithExternalBatch(string input_file)

{

try

{

System.Diagnostics.Process job = new System.Diagnostics.Process();

job .StartInfo.FileName = "pkzip.exe";

job .StartInfo.Arguments = "-add " +
ConfigurationManager.AppSettings["TargetZipFile"].ToString()+ " " +
Server.MapPath(input_file);



job .StartInfo.UseShellExecute = false;

job .StartInfo.RedirectStandardOutput = true;

job .Start();

job .StandardOutput.ReadToEnd();

job.WaitForExit();

catch (Exception ex)

{

AppLog.Write(ex);

}
 
Jens said:
I use the code below to zip files to a single .zip destination. I get the
expected result when i work on my developement machine (WinXP sp.2).

When i deploy the web application which host the code on win2k3 , it only
works for a single file.

I gave the modify right to "Noetwork Service" on the folder i'm writing to.
It does not help.
System.Diagnostics.Process job = new System.Diagnostics.Process();
job .StartInfo.FileName = "pkzip.exe";
job .StartInfo.Arguments = "-add " +
ConfigurationManager.AppSettings["TargetZipFile"].ToString()+ " " +
Server.MapPath(input_file);
job .StartInfo.UseShellExecute = false;
job .StartInfo.RedirectStandardOutput = true;
job .Start();
job .StandardOutput.ReadToEnd();
job.WaitForExit();

Permission problems, different version of pkzip or something
else.

I would suggest switch from Process.Start woth pkzio to
programmatic zipping (either #ZipLib or the java.util.zip hack).

Faster, less dependence on environment and better error
messages.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top