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.
| Author |
Topic |
|
schinni
Yak Posting Veteran
66 Posts |
Posted - 2004-06-18 : 08:47:48
|
| Hello,I wanted to see if a file existed in a particular directory or noti know we can use xp_filexist to find it if you know the file nameis there a way you can use the same to find a file if you don't the file name also Like this. Xp_fileexist 'C:\Test\*.bat' |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-06-18 : 08:54:38
|
| Nope. You can use this though.CREATE TABLE #dir( dirresults VARCHAR(2000))INSERT #dir(dirresults) EXEC master..xp_cmdshell 'dir C:\Test\*.bat /B'IF (SELECT TOP 1 dirresults FROM #dir) = 'The system cannot find the file specified.' PRINT 'It ain''t there'ELSE PRINT 'You''r in business.'MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
schinni
Yak Posting Veteran
66 Posts |
Posted - 2004-06-18 : 09:18:55
|
| is there anything i do without using xp_cmdshell. |
 |
|
|
|
|
|