From 77c88fa63a8000fbf6c2d552d6ae484113920f73 Mon Sep 17 00:00:00 2001 From: Stephen Fromm Date: Tue, 25 Sep 2012 14:57:32 -0700 Subject: [PATCH] Give nice error message if destination directory doesn't exist (issue #1048) --- copy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/copy b/copy index 6491f6ea5e7..de5ebcf4097 100755 --- a/copy +++ b/copy @@ -56,6 +56,8 @@ def main(): module.fail_json(msg="Destination %s cannot be a directory" % (dest)) md5sum_dest = module.md5(dest) else: + if not os.path.exists(os.path.dirname(dest)): + module.fail_json(msg="Destination directory %s does not exist" % (os.path.dirname(dest))) if not os.access(os.path.dirname(dest), os.W_OK): module.fail_json(msg="Destination %s not writable" % (os.path.dirname(dest)))