util/rmall.go (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
package util import ( "os" "path/filepath" ) // Cleans a given directory, removing all files and subdirs. func Clean(dir string) error { files, err := filepath.Glob(filepath.Join(dir, "*")) if err != nil { return err } for _, file := range files { err = os.RemoveAll(file) if err != nil { return err } } return nil } |