diff options
author | haturatu <taro@eyes4you.org> | 2025-03-17 00:29:44 +0900 |
---|---|---|
committer | haturatu <taro@eyes4you.org> | 2025-03-17 00:29:44 +0900 |
commit | d14075115766ac0dec86f8a9a5208d1834e0c018 (patch) | |
tree | 55876f5ae188de53fd81680002a9132528f17717 /internal/local | |
parent | dd932e5db50a4610fa59e08cd4aa2ee11d5eeb4d (diff) |
add: gscp
Diffstat (limited to 'internal/local')
-rw-r--r-- | internal/local/files.go | 30 |
1 files changed, 30 insertions, 0 deletions
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 +} |