FindFiles:
This function allow to get all files in on directory.
select *
from [dbo].[FindFiles]('C:\bin','',0,'file1,file2')
parameters:
@path
it's the directory where find the files
@filter
it's the extension to filter the files
@subdir
0 -> only this directory
1 -> also sub directories
@files
not necessary.
you can list the files you would find to get a faster check. (',' delimited and without extension).
insted to loop all folder, funcion will get only the files you need