MCPcopy Create free account
hub / github.com/capable-average/tagTonic / findMP3Files

Function findMP3Files

cmd/batch.go:105–132  ·  view source on GitHub ↗
(dir, pattern string, recursive bool)

Source from the content-addressed store, hash-verified

103}
104
105func findMP3Files(dir, pattern string, recursive bool) ([]string, error) {
106 var files []string
107
108 walkFunc := func(path string, info os.FileInfo, err error) error {
109 if err != nil {
110 return err
111 }
112
113 if info.IsDir() && !recursive && path != dir {
114 return filepath.SkipDir
115 }
116
117 if !info.IsDir() {
118 matched, err := filepath.Match(pattern, info.Name())
119 if err != nil {
120 return err
121 }
122 if matched {
123 files = append(files, path)
124 }
125 }
126
127 return nil
128 }
129
130 err := filepath.Walk(dir, walkFunc)
131 return files, err
132}
133
134type BatchStats struct {
135 processed int

Callers 1

batch.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected