cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How to monitor a directory?

pzhou1
1-Visitor

How to monitor a directory?

Hi, I have a use case where data files are generated periodically, and I need to ingest these data files to Thingworx platform and stored. Is there a way I can monitor the directory where data files are, and trigger Thingworx to process (parse and store to database) the file when a new file is saved to the directory? thanks a lot!

4 REPLIES 4

There's no events for new files, but you can poll for directory changes with a Timer Thing.

This will be my last resolution, if no events, thank you.

supandey
19-Tanzanite
(To:pzhou1)

Ping, i suppose the most basic thing here to begin with is to have an event which must fire to notify automatically whenever there's a new file added to the directory. Now if this directory is not part of the thingworx repository the event, that should fire to notify change/update, should fire on the OS's file system.

If you are working on Windows you can check the IO.FileSystemWatcher  class which can be invoked from powershell(includes the sample) and then you can do a HTTP POST to ThingWorx with the file for processing

If you are on Linux it'll be inotify

hope this helps.

pzhou1
1-Visitor
(To:supandey)

Thank you for your recommendation. I thought of this as well, but if I have multiple folders to monitor, creating an additional application(s) to generate this event might not be a good choice, in terms of maintainability and scalability.

Announcements


Top Tags