Skip to content

Watcher in Go Lang. Trigger fired when a file is created/modified/removed from a specific directory.

License

Notifications You must be signed in to change notification settings

mangar/gowatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoWatcher

Watch changes (remove, create and changes) on a mapped directory and fire a command for each.

Usage

go run gowatcher config.json

Configuration

Create a json file with the content bellow.

  • dir: directory that will be wathed
  • created / change / delete: entry for each action
  • created / change / delete . cmd: command that will be fired for each event (create, change or remove)
{
  "dir":"/Users/marciog/Projects/__temp/golang_changes_file_dir/watch",
  "create":{
    "cmd": "touch `pwd`/log/`date '+%Y%m%d-%H%M%S'`_create.txt"
  },
  "change":{
    "cmd": "touch `pwd`/log/`date '+%Y%m%d-%H%M%S'`_change.txt"
  },
  "delete":{
    "cmd":"touch `pwd`/log/`date '+%Y%m%d-%H%M%S'`_delete.txt"
  }
}

About

Watcher in Go Lang. Trigger fired when a file is created/modified/removed from a specific directory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages