github.com/simpleiot/simpleiot@v0.18.3/file/util.go (about)

     1  package file
     2  
     3  import (
     4  	"os"
     5  	"os/exec"
     6  )
     7  
     8  // Exists returns true if file exists, else false
     9  func Exists(path string) bool {
    10  	if _, err := os.Stat(path); os.IsNotExist(err) {
    11  		return false
    12  	}
    13  
    14  	return true
    15  }
    16  
    17  // SyncDisks runs the linux "sync" command
    18  func SyncDisks() error {
    19  	return exec.Command("sync").Run()
    20  }