first commit

This commit is contained in:
“xHuPo” 2025-05-09 17:21:06 +08:00
commit aaad8b143f
17 changed files with 818 additions and 0 deletions

33
v1/clean.go Normal file
View file

@ -0,0 +1,33 @@
package main
import (
"log"
"os"
"path/filepath"
)
func Remove(path string) error {
entries, err := os.ReadDir(path)
if err != nil {
log.Printf("clean: Error reading directory: %v", err)
return err
}
for _, entry := range entries {
if entry.IsDir() {
err := Remove(filepath.Join(path, entry.Name()))
if err != nil {
log.Printf("clean: Error removing directory: %v", err)
return err
}
} else {
err := os.Remove(filepath.Join(path, entry.Name()))
if err != nil {
log.Printf("clean: Error removing file: %v", err)
return err
}
}
}
log.Printf("clean: Removed directory successfully: %s", path)
return nil
}