set @p_vdirectory = 'directory'
set @p_vfilename = 'filename'
create table #tchecktable (output varchar(512))
set @l_vsqlstring = 'dir ' + @p_vdirectory+@p_vfilename
--populate the table with the directory info
insert into #tchecktable exec master..xp_cmdshell @l_vsqlstring
--strip out everything except the entry for the file
DELETE FROM #tchecktable WHERE output is NULL
OR right(rtrim(output),len(@p_vfilename)) <> @p_vfilename
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.