SQL Server: a quick way to load a directory tree (name, date modified)

(I was looking for an answer, but so far nothing has been resolved.)

I want to keep the table up to date with the file directory tree in Microsoft SQL Server 2005. I am doing the norm now:

insert into #resultTable (Path)
exec master.dbo.xp_cmdshell 'dir/s/b G:\FileLibrary'

but it takes about 4 1/2 minutes to load each time (not to mention that I still don't know how to get the modified date). Yes, this is a network drive, but starting it locally takes 1 minute 16 seconds, and this is not the only directory I want to check.

Is there something that I can load into SQL Server 2005 as a DLL or maybe C # code that I can compile to allow quick scanning of files modified from a specific time period (including daylight saving time)? Files are stored on the same server as SQL Server.

+3
source share
1 answer

There are many examples of running managed code from SQL Server on the Internet. This is one example .

In doing so, you just need the C # code to track the directory for changes. Perhaps you can use these articles as a starting point: Here and Here .

, Google.

+1

Source: https://habr.com/ru/post/1767948/


All Articles