Question

while the application is running i'm using FileSystemWatcher to monitor the folder. But what if there are changes to the folder when the application is not running, how can I check for these changes when the application starts.

(similar to how windows media player, for example, monitors your music folder. Even when you add songs to that folder when it is not running, it does discover them when it runs next time)

Thanks

Was it helpful?

Solution

You could store a list of what has already been found in a file and then compare it with the current state at startup.
Otherwise you could create a service that starts at system startup and always watches the folder and when your app starts up it polls the service for any changes since it last polled.

OTHER TIPS

You can use the LastWriteTime which is in the System.IO.Directory or in the System.IO.DirectoryInfo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top