refresh directory

  • Thread starter Thread starter Dave Cullen
  • Start date Start date
D

Dave Cullen

My appplication spawns an external DOS process that creates a file. I
use Process.Start() and Process.Close() for calling that. After the
process closes, I look for the existance of the file it created.

The problem is that checking the existance of the file with
IO.File.Exists() fails, even though the file was created. If I step
through the program in debug mode it works fine.

Is there a way to "refresh" the directry first, so I'll see the file?
 
Dave Cullen said:
The problem is that checking the existance of the file with
IO.File.Exists() fails, even though the file was created. If I step
through the program in debug mode it works fine.

Is there a way to "refresh" the directry first, so I'll see the file?


Perhaps you are refreshing the directory too quickly?

Another alternative is to use the Directory.GetFiles method... you can
specify a file filter to return only the file names you want.
 
Dave,

Are you sure the seperated proces is ended when you do the IO.File.Exist?

Cor
 
Dave Cullen said:
My appplication spawns an external DOS process that creates a file. I
use Process.Start() and Process.Close() for calling that. After the
process closes, I look for the existance of the file it created.

Use 'Process.WaitForExit' to wait for the process to exit. Then check if
the file exists.
 
Herfried,

Give you always the answer that is probably obvious from my message, that
makes it impossible to do a simple dialog in this newsgroup?

Cor
 
Back
Top