Skip to content

Commit 0167cc7

Browse files
committed
added filespath func to get abs file path recursively
1 parent 0431c24 commit 0167cc7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

filepath.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func DeleteFiles(files ...string) (errs []error) {
266266
return
267267
}
268268

269-
// DirsPath method returns all directories path from given base path recursively.
269+
// DirsPath method returns all directories absolute path from given base path recursively.
270270
func DirsPath(basePath string) (pdirs []string, err error) {
271271
err = Walk(basePath, func(srcPath string, info os.FileInfo, err error) error {
272272
if info.IsDir() {
@@ -277,6 +277,17 @@ func DirsPath(basePath string) (pdirs []string, err error) {
277277
return
278278
}
279279

280+
// FilesPath method returns all files absolute path from given base path recursively.
281+
func FilesPath(basePath string) (files []string, err error) {
282+
err = Walk(basePath, func(srcPath string, info os.FileInfo, err error) error {
283+
if !info.IsDir() {
284+
files = append(files, srcPath)
285+
}
286+
return nil
287+
})
288+
return
289+
}
290+
280291
// StripExt method returns name of the file without extension.
281292
// E.g.: index.html => index
282293
func StripExt(name string) string {

0 commit comments

Comments
 (0)