473,378 Members | 1,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

refresh directory

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?
Nov 21 '05 #1
5 1807
Dave Cullen <no*****@mail.com> wrote in news:41***************@mail.com:
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.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2
Dave,

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

Cor

"Dave Cullen" <no*****@mail.com>
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?

Nov 21 '05 #3
"Dave Cullen" <no*****@mail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
That worked.... thanks.

"Herfried K. Wagner [MVP]" wrote:

"Dave Cullen" <no*****@mail.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
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
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bite My Bubbles | last post by:
I found the answer! It is a IIS 6 /ASP problem http://support.microsoft.com/default.aspx?scid=kb;en-us;332075
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: Luna Kwok | last post by:
Hello, I have a very strange problem. When I load up a page, all the images look fine, but when I refresh the page, all the images become dead. This happens on both IE and netscape. I have...
2
by: AJang | last post by:
My windows form "Form1" has one Button "button1" and one TextBox "textBox1". When I click button1, it do a job for each file in a directory. The job include some platform invoke call. Before...
0
by: tshad | last post by:
I got a piece of code to check if a Web page was refreshed (user pressed refresh button). But I can't get it to work. The code is: ************************************************************...
3
by: Lennart | last post by:
Assuming the following setup: Server1 running DB2 V8.2 with two databases DB_1 and DB_2: db2 catalog db DB_1 as CURR_DB Server2 DB2 runtime client: db2 catalog tcpip node S1 remote...
0
Boxcar74
by: Boxcar74 | last post by:
Hi Everybody!!! I have an Issue. I have an Excel file that queries an Access db. I’m trying to have it so I don’t have to keep updating it manually everyday and save it to a network drive...
3
by: rullbandspelare | last post by:
I have a directory that contains images wich are displayed with this code: (All it does, is going through all the images in the directory and displays them). <?php function...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.