Automatically execute command when file is modified
Go to file
nikobojs afd2cee62a updated 2019-11-02 12:31:27 +01:00
.gitignore initial commit 2019-11-02 12:28:31 +01:00 initial commit 2019-11-02 12:28:31 +01:00 updated 2019-11-02 12:31:27 +01:00
filewatch.go initial commit 2019-11-02 12:28:31 +01:00


Automatically execute command when file is modified


Filewatch listens to all files with a filename that matches a regular expression. It spawns a new goroutine for each file it listens to. Each goroutine loops every second and executes a command if the file is modified.


  • Install Go
  • git clone
  • go build filewatch.go

Run program

  • First argument is the regular expression
  • The rest of the arguments will be executed when files are modified
  • Keyword {fname} can be used for injecting filename into the command
  • usage: ./filewatch [regex] [command]
  • example: ./filewatch '.+\\.go' go fmt {fname}


This project is licensed under the MIT License - see the file for details