lsutiger2008
11th September 2008, 00:06
I have a program that is supposed to zip a bunch of files and name them to a standard for each of our locations. The program was originally written in VS for windows and worked great.
I now rewrote it in Mono-develop for linux and of course I had to change the path information of zip.
Here's the relevant codestrArgs = DateTime.Now.AddMonths(-1).ToShortDateString();
strArgs = strArgs.PadLeft(10,'0');
strArgs = strArgs.Remove(2,4);
file = file.PadLeft(2,'0');
strArgs = " /home/brian/EOM" + file + strArgs + ".ZIP";
path = " /home/brian/EOM/" + file + "/*.M" + file;
strArgs = strArgs + path;
//Console.Write(strArgs);
myProcess.StartInfo.FileName = "zip";
myProcess.StartInfo.Arguments = strArgs;
myProcess.StartInfo.CreateNoWindow = true;
try
{
myProcess.Start();
myProcess.WaitForExit();
}
catch (SystemException caught)
{
Console.WriteLine(caught.ToString());
continue;
}
This produces a string of arguments as such:
/home/brian/EOM01082008.ZIP /home/brian/EOM/01/*.M01
but I get "zip warning: name not matched: /home/brian/EOM/01/*.M01" and nothing gets created. Yet when I do "zip /home/brian/EOM01082008.ZIP /home/brian/EOM/01/*.M01" in the CLI it works.
Any idea?
Thanx in advance!
I now rewrote it in Mono-develop for linux and of course I had to change the path information of zip.
Here's the relevant codestrArgs = DateTime.Now.AddMonths(-1).ToShortDateString();
strArgs = strArgs.PadLeft(10,'0');
strArgs = strArgs.Remove(2,4);
file = file.PadLeft(2,'0');
strArgs = " /home/brian/EOM" + file + strArgs + ".ZIP";
path = " /home/brian/EOM/" + file + "/*.M" + file;
strArgs = strArgs + path;
//Console.Write(strArgs);
myProcess.StartInfo.FileName = "zip";
myProcess.StartInfo.Arguments = strArgs;
myProcess.StartInfo.CreateNoWindow = true;
try
{
myProcess.Start();
myProcess.WaitForExit();
}
catch (SystemException caught)
{
Console.WriteLine(caught.ToString());
continue;
}
This produces a string of arguments as such:
/home/brian/EOM01082008.ZIP /home/brian/EOM/01/*.M01
but I get "zip warning: name not matched: /home/brian/EOM/01/*.M01" and nothing gets created. Yet when I do "zip /home/brian/EOM01082008.ZIP /home/brian/EOM/01/*.M01" in the CLI it works.
Any idea?
Thanx in advance!