Index: /trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp	(revision 71532)
+++ /trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp	(revision 71533)
@@ -1390,11 +1390,11 @@
     }
 
-    const char *pszFileName = mSource.c_str();
-
-    if (   !pszFileName
-        || !RTFileExists(pszFileName))
+    const char *pszSrcFile = mSource.c_str();
+
+    if (   !pszSrcFile
+        || !RTFileExists(pszSrcFile))
     {
         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                            Utf8StrFmt(GuestSession::tr("Source file \"%s\" not valid or does not exist"), pszFileName));
+                            Utf8StrFmt(GuestSession::tr("Source file \"%s\" not valid or does not exist"), pszSrcFile));
         return VERR_FILE_NOT_FOUND;
     }
@@ -1408,5 +1408,6 @@
     }
 
-    /** @todo Try to lock the destination directory on the guest here first? */
+    /** @todo Try to lock the destination file / directory on the guest here first? */
+    char *pszDstFile = NULL;
 
     int rc = VINF_SUCCESS;
@@ -1426,11 +1427,16 @@
             {
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                    Utf8StrFmt(GuestSession::tr("Path \"%s\" is not a directory on guest"), mDest.c_str()));
+                                    Utf8StrFmt(GuestSession::tr("Path \"%s\" is not a directory on guest"), pszDstFile));
                 rc = VERR_NOT_A_DIRECTORY;
             }
             else
             {
-                AssertPtr(pszFileName);
-                mDest += pszFileName;
+                /* Build the final file name with destination path (on the guest). */
+                char szDstPath[RTPATH_MAX];
+                RTStrPrintf2(szDstPath, sizeof(szDstPath), "%s", mDest.c_str());
+
+                RTPathAppend(szDstPath, sizeof(szDstPath), RTPathFilename(pszSrcFile));
+
+                pszDstFile = RTStrDup(szDstPath);
             }
         }
@@ -1447,20 +1453,27 @@
                     setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                         Utf8StrFmt(GuestSession::tr("Unable to query information for directory \"%s\" on the guest: %Rrc"),
-                                                   mDest.c_str(), rc));
+                                                   pszDstFile, rc));
                     break;
             }
         }
     }
+    else
+        pszDstFile = RTStrDup(mDest.c_str());
 
     if (RT_SUCCESS(rc))
     {
+        AssertPtrReturn(pszDstFile, VERR_NO_MEMORY);
+
         if (mSourceFile) /* Use existing file handle. */
-            rc = fileCopyToEx(mSource, mDest, (FileCopyFlag_T)mFileCopyFlags, mSourceFile, mSourceOffset, mSourceSize);
+            rc = fileCopyToEx(pszSrcFile, pszDstFile, (FileCopyFlag_T)mFileCopyFlags, mSourceFile, mSourceOffset, mSourceSize);
         else
-            rc = fileCopyTo(mSource, mDest, (FileCopyFlag_T)mFileCopyFlags);
+            rc = fileCopyTo(pszSrcFile, pszDstFile, (FileCopyFlag_T)mFileCopyFlags);
 
         if (RT_SUCCESS(rc))
             rc = setProgressSuccess();
     }
+
+    if (pszDstFile)
+        RTStrFree(pszDstFile);
 
     LogFlowFuncLeaveRC(rc);
