You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a Windows 10 machine I have a Go program which uses fsnotify to watch for changes for a .txt file. When i open the .txt file in notepad without changing anything and closing without saving, fsnotify notifies about a file change. This happens only one time after the Computer has started or returned from sleep-mode
This is how I listen for file change events:
for {
select {
case _, ok := <-fw.Events:
if ok {
log.Println("File changed")
}
case err, _ := <-fw.Errors:
log.Println("FileWatcher error:", err)
}
}
Fsnotify registered a change for .txt at : 20:25
The windows properties for .txt shows last changes at: 19:12
The text was updated successfully, but these errors were encountered:
Both FILE_NOTIFY_CHANGE_LAST_ACCESS and FILE_NOTIFY_CHANGE_LAST_WRITE will emit FILE_ACTION_MODIFIED event. I think there should be an option to disable last access time triggering Write op event.
arp242
changed the title
Fsnotify notifies about a file change on Windows when nothing happend to the file
Notifications when nothing happened after the computer starts or wakes from sleep mode
Aug 4, 2022
I think #520probably fixed this; I think some program changed file attributes on wakeup, which would show up as Write events because that's how the Windows API sends them or some reason.
Let me know if it's not fixed with that PR and we can look further.
On a Windows 10 machine I have a Go program which uses
fsnotify
to watch for changes for a .txt file. When i open the .txt file in notepad without changing anything and closing without saving, fsnotify notifies about a file change. This happens only one time after the Computer has started or returned from sleep-modeThis is how I listen for file change events:
Fsnotify registered a change for
.txt
at : 20:25The windows properties for
.txt
shows last changes at: 19:12The text was updated successfully, but these errors were encountered: