more initial changes

This commit is contained in:
Javis Sullivan
2025-12-08 07:56:46 -05:00
parent 0e0fe0e37c
commit 4bed19ab73
14 changed files with 701 additions and 32 deletions

View File

@@ -0,0 +1,19 @@
package mover
import (
"fmt"
"os"
"path/filepath"
)
// Move moves the file to destDir/destName, creating directories as needed.
func Move(src, destDir, destName string) (string, error) {
if err := os.MkdirAll(destDir, 0o755); err != nil {
return "", fmt.Errorf("mkdir %s: %w", destDir, err)
}
destPath := filepath.Join(destDir, destName)
if err := os.Rename(src, destPath); err != nil {
return "", fmt.Errorf("rename %s -> %s: %w", src, destPath, err)
}
return destPath, nil
}