
May 27th, 2004, 08:59 PM
|
|
Registered User
|
|
Join Date: May 2004
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
How to detect if an application created a file.
I've got a partial solution to this problem, wonder if anyone can add.
I want to run some business application progran on a Windows 2000 Server (it's an import program), then check if it created a specific file. I use the method:
System.Diagnostics.Process.Start(strCmd)
Which is supposed to be Syhchronous (waits for process to end before returning control), a big advantage over the old vb.
Then I use: System.IO.File.Exists(strFileName) to test wether the command ran OK. It usually works, but sometimes, even though manual inspection shows it was created, not which tells me System.Diagnostics.Process.Start in this case might not be synchronous.
I'm told the process I'm running may spawn other processes itself.
1) What can I run that waits for ALL processes to end, not just the parent,
2) or is Process.Start supposed to do this, I'm doing something wrong,
3) or is there at least an easy way to wait for a file -say 2 seconds and time out if none found by then?
4) Any other suggestions?
I'm using a vb.net code behind dll if that makes a difference,
but I assume C# is the same.
John
|