I am zipping files in a folder using the DotNetZip libraries. To identify files that are currently open by other processes I am using 'handle.exe' from SysInternals.com. I do this by calling it with parameters and parsing the output, along these lines.
using (Process handleProcess = new Process())
{
// -- Set up the parameters and call the process.
handleProcess.StartInfo.FileName = "handle.exe";
handleProcess.StartInfo.UseShellExecute = false;
handleProcess.StartInfo.RedirectStandardOutput = true;
handleProcess.StartInfo.Arguments = "-u " + fileName;
handleProcess.Start();
...
Which works but has the air of a kludge about it. Can anyone suggest a better approach within managed code ?