From ef702f73edef68e4d6c8d73d3f67c9e5dee3d1fd Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Mon, 17 Jun 2024 10:41:00 +0700 Subject: [PATCH] skip hidden files when list files with given extension (#10654) for https://github.com/ledgerwatch/erigon/issues/10644 --- common/dir/rw_dir.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/dir/rw_dir.go b/common/dir/rw_dir.go index c9d0a1b6..6e07f666 100644 --- a/common/dir/rw_dir.go +++ b/common/dir/rw_dir.go @@ -19,6 +19,7 @@ package dir import ( "os" "path/filepath" + "strings" "golang.org/x/sync/errgroup" ) @@ -133,6 +134,9 @@ func ListFiles(dir string, extensions ...string) (paths []string, err error) { if f.IsDir() && !f.Type().IsRegular() { continue } + if strings.HasPrefix(f.Name(), ".") { + continue + } match := false if len(extensions) == 0 { match = true