Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Check to see if File Exists

Author  Topic 

WYSIWYG
Starting Member

15 Posts

Posted - 2005-10-25 : 08:50:48
I am trying to see if an XML file exists before using the path elsewhere. The logic goes like this.

If (file exists)
// set the file path
Else
// set a different file path

Then use the file path (that exists).

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-25 : 08:54:43
Run this to know if file exists

Exec Master..xp_cmdshell 'Dir file path'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

WYSIWYG
Starting Member

15 Posts

Posted - 2005-10-25 : 08:56:15
I will look into this.

I neglected to say that I am doing this in C# .NET
Go to Top of Page

WYSIWYG
Starting Member

15 Posts

Posted - 2005-10-25 : 08:58:19
I want to do this using C# code, not through SQL.

quote:
Originally posted by WYSIWYG

I will look into this.

I neglected to say that I am doing this in C# .NET

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-25 : 08:58:51
Then do this work there using File System Object

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-10-25 : 09:29:33
[code]
if (File.Exists(path))
{
//do stuff
}
[/code]


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -