From d14075115766ac0dec86f8a9a5208d1834e0c018 Mon Sep 17 00:00:00 2001 From: haturatu Date: Mon, 17 Mar 2025 00:29:44 +0900 Subject: add: gscp --- internal/local/files.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 internal/local/files.go (limited to 'internal/local/files.go') diff --git a/internal/local/files.go b/internal/local/files.go new file mode 100644 index 0000000..e4b4f67 --- /dev/null +++ b/internal/local/files.go @@ -0,0 +1,30 @@ +package local + +import ( + "os" + "path/filepath" +) + +// GetFiles retrieves a map of files in the local destination directory +func GetFiles(destDir string) (map[string]bool, error) { + files := make(map[string]bool) + + err := filepath.Walk(destDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if !info.IsDir() { + // Get relative path + relPath, err := filepath.Rel(destDir, path) + if err != nil { + return err + } + files[relPath] = true + } + + return nil + }) + + return files, err +} -- cgit v1.2.3