all repos — vite @ bce0b549b8c10271ee7df30d6d7c78af2675cf6c

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}