all repos — vite @ 71bec3e96b175b5960f518aefae0faae433af030

a fast (this time, actually) and minimal static site generator

util/rmall.go (view raw)

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