Add StringTitle
This commit is contained in:
25
file.go
Normal file
25
file.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package commons
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// FileDeepScan will scan dir recursively and append any files found to files.
|
||||
func FileDeepScan(dir string, files *[]string) {
|
||||
entries, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
log.Printf("Failed to read %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
fullPath := filepath.Join(dir, entry.Name())
|
||||
if entry.IsDir() {
|
||||
FileDeepScan(fullPath, files)
|
||||
} else {
|
||||
*files = append(*files, filepath.Join(dir, entry.Name()))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user