HOW TO RUN
- Create a new .NET console app (.NET 6 and above will work).
- Replace Program.cs with this code.
- Run it. It will watch your Documents/WatchedFolder by default.
- Try adding/renaming/deleting files — you’ll now see a single clean log per change.
Safety note
- Only reads file events; does not modify or transmit data.
Learning goals
- Using FileSystemWatcher safely.
- Handling event spam via debouncing.
- Simple log rotation and thread safety.
- Graceful shutdown.