This commit is contained in:
weidong 2025-01-01 18:09:00 +08:00
parent b91dfb3eee
commit 3d2b753006
3 changed files with 19 additions and 12 deletions

2
go.mod
View File

@ -1,3 +1,3 @@
module replace_google_fonts
module batch_op_file
go 1.23.3

17
print/main.go Normal file
View File

@ -0,0 +1,17 @@
package main
import (
"batch_op_file/util"
"fmt"
"os"
)
func main() {
var paths []string
rootDir, _ := os.Getwd()
paths, _ = util.GetAllFile(rootDir, paths, []string{".git", ".idea", ".vscode", ".gitignore", ".gitea", ".github", ".golangci.yml", "*.pyc"})
for _, fp := range paths {
fmt.Println(fp)
}
}

View File

@ -1,4 +1,4 @@
package main
package util
import (
"fmt"
@ -7,16 +7,6 @@ import (
"strings"
)
func main() {
var paths []string
rootDir, _ := os.Getwd()
paths, _ = GetAllFile(rootDir, paths, []string{".git", ".idea", ".vscode", ".gitignore", ".gitea", ".github", ".golangci.yml", "*.pyc"})
for _, fp := range paths {
fmt.Println(fp)
}
}
func GetAllFile(pathname string, s []string, filter []string) ([]string, error) {
rd, err := os.ReadDir(pathname)
if err != nil {