PC Review


Reply
 
 
=?Utf-8?B?amV6MTIzNDU2?=
Guest
Posts: n/a
 
      11th Feb 2005
Hi, I need to check that 4 access database files exist and they are not in
use before I can process them.

For example say my files are:

C:\test\data1.mdb
C:\test\data2.mdb
C:\test\data3.mdb
C:\test\data4.mdb

I can use if (File.Exists(dbName)) on each one but is there a more generic
way of doing this with a method, an array or looping through them.

Basically I'm looking to check the files exist, if not show a message
reporting which file is missing. Also, check that the files are not open,
then again show a message if they are. The message will need to ask the user
if they want to carry on processing the other databases or cancel the whole
thing.

Thanks




 
Reply With Quote
 
 
 
 
Sean Hederman
Guest
Posts: n/a
 
      11th Feb 2005
Use DirectoryInfo.GetFiles(), there's an overload that will take a search
pattern ("data*.mdb") and return an array of files, then just loop through
the files returned, looking for gaps.

"jez123456" <(E-Mail Removed)> wrote in message
news:6697BC44-B325-4193-86CE-(E-Mail Removed)...
> Hi, I need to check that 4 access database files exist and they are not in
> use before I can process them.
>
> For example say my files are:
>
> C:\test\data1.mdb
> C:\test\data2.mdb
> C:\test\data3.mdb
> C:\test\data4.mdb
>
> I can use if (File.Exists(dbName)) on each one but is there a more generic
> way of doing this with a method, an array or looping through them.
>
> Basically I'm looking to check the files exist, if not show a message
> reporting which file is missing. Also, check that the files are not open,
> then again show a message if they are. The message will need to ask the
> user
> if they want to carry on processing the other databases or cancel the
> whole
> thing.
>
> Thanks
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can I go to check my Compressed files from deleted files? Frank ! Windows Vista General Discussion 0 14th Jun 2008 08:30 AM
When to Check-out/check-in files in Visual Source Safe =?Utf-8?B?Umljaw==?= Microsoft VB .NET 2 15th Nov 2007 04:53 PM
WIn XP files check =?Utf-8?B?RGF2ZQ==?= Windows XP General 4 25th Oct 2006 06:49 PM
Can I Check Out and Check In files from VSS through .NET Code? =?Utf-8?B?SW1heWFrdW1hcg==?= Microsoft Dot NET 2 11th Feb 2005 02:40 PM
Check for files Foss Microsoft Excel Programming 4 15th Jun 2004 10:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:26 AM.