We help IT Professionals succeed at work.

Monitor a folder for new files

Camillia
Camillia asked
on
I have a folder c:\test
I get 4 files in it: PX.txt, PXDelta.txt, NX.ext and NXDelta.txt

I need to monitor this folder for these files. Call a stored proc to import them into a table (i have this code already) and rename the file (i have this as well)

Can I monitor a folder to see if a new file by name of PX.Txt is copied into that folder with a SQL job?
Comment
Watch Question

Éric MoreauSenior .Net Consultant
BRONZE EXPERT
Top Expert 2016

Commented:
that would be easy using a .Net application and the FileSystemWatcher but no clue for straight from SQL
BRONZE EXPERT

Author

Commented:
ah, that's a good idea. Then schedule that .net application? i was also thinking about a BAT file...but dont think i can do it with a BAT file.
Senior .Net Consultant
BRONZE EXPERT
Top Expert 2016
Commented:
just a .Net application that uses the FileSystemWatcher to detect any files activity and trigger an action when it happens.

check http://emoreau.com/Entries/Articles/2005/04/The-FileSystemWatcher-component.aspx
BRONZE EXPERT

Author

Commented:
thanks, let me see

Explore More ContentExplore courses, solutions, and other research materials related to this topic.