diff --git a/internal/restic/node.go b/internal/restic/node.go index 54b67c672..341d88118 100644 --- a/internal/restic/node.go +++ b/internal/restic/node.go @@ -299,8 +299,12 @@ func (node Node) createSymlinkAt(path string) error { if runtime.GOOS == "windows" { return nil } - err := fs.Symlink(node.LinkTarget, path) - if err != nil { + + if err := os.RemoveAll(path); err != nil && !errors.Is(err, os.ErrNotExist) { + return errors.Wrap(err, "Symlink") + } + + if err := fs.Symlink(node.LinkTarget, path); err != nil { return errors.Wrap(err, "Symlink") }