From 92421ec47fa3dbf1dd74a65a6b3c53641c90621a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 15 Jul 2018 16:02:04 +0200 Subject: [PATCH] restore: Make sure target directory exists --- internal/restorer/restorer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/restorer/restorer.go b/internal/restorer/restorer.go index 641b05877..160497110 100644 --- a/internal/restorer/restorer.go +++ b/internal/restorer/restorer.go @@ -197,6 +197,12 @@ func (res *Restorer) RestoreTo(ctx context.Context, dst string) error { } } + // make sure the target directory exists + err = fs.MkdirAll(dst, 0777) // umask takes care of dir permissions + if err != nil { + return errors.Wrap(err, "MkdirAll") + } + idx := restic.NewHardlinkIndex() return res.traverseTree(ctx, dst, string(filepath.Separator), *res.sn.Tree, treeVisitor{ enterDir: func(node *restic.Node, target, location string) error {