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 for folder

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-05-01 : 23:15:19
Is there a way to check if a folder exists using xp_cmdshell or another method. I need to list documents is a folder exists.

thanks in advance

slow down to move faster...

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-05-01 : 23:35:04
Hi

There is an undocumented Extended Stored Procedure called xp_fileexist that will do this for you.

exec master..xp_fileexist 'C:\'

will return something like


File Exists File is a Directory Parent Directory Exists
----------- ------------------- -----------------------
0 1 1



If there is a 1 for [file is a directory], then it exists.

For more info on this proc, and a bunch more, you should buy

The Guru's Guide to SQL Server Stored Procedures, XML, and HTML

Damian
Go to Top of Page

skillile
Posting Yak Master

208 Posts

Posted - 2002-05-02 : 00:21:10
Sounds good.

I do have the book. I was looking at the sp_msexists_file sproc
page 633 and couldn't get it to work.

Any suggestions

slow down to move faster...
Go to Top of Page
   

- Advertisement -