all repos — vite @ d3cb74b6d1df9cca082c7fab84325b36c0bce969

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}