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 |
Rekha
Starting Member
14 Posts |
Posted - 2008-03-24 : 06:00:22
|
Hi,I have in a requirement to check if there is any file with extension of ".fil" in a folder.I wrote the query declare @Path varchar(128) , @FileName varchar(128) select @Path = 'E:\CURRENT_DATA\Processing\' , @FileName = 'generic.fil'declare @i intdeclare @File varchar(1000) select @File = @Path + @FileName exec master..xp_fileexist @File, @i out if @i = 1-- print 'exists'RAISERROR ('Job "Load all queues" failed as there is .fil file present in processing folder',16,1) else print 'not exists'I dont want to hardcode the file name as there can be any file with extension of .fil, please help me check the way windows search works like *.filThanks in advance |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-03-24 : 06:14:29
|
Any particular reason why you want to do this from SQL Server itself? You can easily handle this check from the front-end.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
fahad_001
Starting Member
11 Posts |
Posted - 2008-03-24 : 06:54:09
|
CREATE PROCEDURE Sp_file@fname as varchar(128)ASdeclare @Path varchar(128) ,@FileName varchar(128)select @Path = 'E:\GRLI\images\' ,@FileName = @fnamedeclare @i intdeclare @File varchar(1000)select @File = @Path + @FileNameexec master..xp_fileexist @File, @i outif @i = 1-- print 'exists'print 'File exists'elseprint 'not exists'GOJust Create a input parameter and pass that file name in store procedure |
 |
|
|
|
|