<de*****************@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Anybody?
thanks,
Sean
Very easy, use System.Management and WMI's class Win32_Directory method
Compress.
Here's a sample....
using System.Management;
....
string dirName = "c:\\\\somefolder";
string objPath = "Win32_Directory.Name=" + "\"" + dirName + "\"";
Console.WriteLine(objPath);
using (ManagementObject dir= new ManagementObject(objPath))
{
ManagementBaseObject outParams = dir.InvokeMethod("Compress", null,
null);
uint ret = (uint)(outParams.Properties["ReturnValue"].Value);
if(ret == 0)
Console.WriteLine("Success");
else Console.WriteLine("Failed with error code: {0}", ret);
}
Willy.