Skip to content

Instantly share code, notes, and snippets.

@imsodin
Created March 12, 2019 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imsodin/dbbbbd4c662cd16f66c1a9281a3df9ed to your computer and use it in GitHub Desktop.
Save imsodin/dbbbbd4c662cd16f66c1a9281a3df9ed to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"strings"
"github.com/syncthing/notify"
)
var drive = "C"
func main() {
lower := strings.ToLower(drive)
upper := strings.ToUpper(drive)
for _, prefix := range []string{`\\?\`, ""} {
c := make(chan notify.EventInfo)
for _, d := range []string{upper, lower} {
for _, sep := range []string{"", `\`} {
for _, rec := range []string{"...", ""} {
path := prefix + d + ":" + sep + rec
err := notify.Watch(path, c, notify.All)
fmt.Printf("Watching \"%v\": %v\n", path, err)
if err == nil {
notify.Stop(c)
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment