Monitor a directory for file changes.

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Monitor a directory for file changes.

Post by apoorv569 »

Is it possible to check a directory and the sub-directories inside it on the system to check if a new file is created/added or if a file is deleted from that directory and all the sub-directories, and get the path to that file that is added or removed?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Monitor a directory for file changes.

Post by PB »

https://docs.wxwidgets.org/trunk/classw ... tcher.html

You can see it in action with fswatcher sample.
apoorv569
Super wx Problem Solver
Super wx Problem Solver
Posts: 426
Joined: Tue Oct 20, 2020 3:35 pm

Re: Monitor a directory for file changes.

Post by apoorv569 »

PB wrote: Sun Mar 28, 2021 9:13 pm https://docs.wxwidgets.org/trunk/classw ... tcher.html

You can see it in action with fswatcher sample.
Nice, this looks exactly like, what I was looking for. BTW, looking at the source, it seems like this needs to be created in the wxApp class, as it needs to be in the application loop?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Monitor a directory for file changes.

Post by PB »

I think you misunderstood the docs. It just needs the event loop running, which means it cannot be used in a console application without one. But there are no special requirements otherwise.
Post Reply