diff options
Diffstat (limited to 'internal/local/files.go')
-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 +} |