diff --git a/README.md b/README.md index 961a596..1e2059b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # fsutil - - This cross-platform go module provides a lightweight abstraction of common file system methods: - `Touch(path string)`: Like the Unix [touch command](https://en.wikipedia.org/wiki/Touch_(command)). Returns a string with the absolute path of the file/directory. @@ -19,8 +17,8 @@ This cross-platform go module provides a lightweight abstraction of common file - `ByteSize(path string)`: Determines the size (in bytes) of a file or directory. - `Size(path string, decimalPlaces int)`: A "pretty" label for the size of a file or directory. For example, `3.14MB`. - `FormatSize(size int64, decimalPlaces int)`: Pretty-print the byte size, i.e. `3.14MB`. -- `Copy(source string, target string) error`: Copy a file/directory contents. -- `Move(source string, target string) error`: Move a file/directory contents. +- `Copy(source string, target string) error`: Copy a file/directory contents. Ignores symlinks. +- `Move(source string, target string) error`: Move a file/directory contents. Ignores symlinks. ## Example diff --git a/fsutil.go b/fsutil.go index ab3b7ac..28fe540 100644 --- a/fsutil.go +++ b/fsutil.go @@ -453,7 +453,7 @@ func Move(source string, dest string) error { if info.IsDir() { Touch(target) - } else { + } else if !IsSymlink(path) { err := os.Rename(path, target) if err != nil { return err @@ -475,7 +475,7 @@ func Copy(source string, dest string) error { if info.IsDir() { Touch(target) - } else { + } else if !IsSymlink(path) { input, err := ioutil.ReadFile(path) if err != nil { return err