Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 33790)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp	(revision 33791)
@@ -630,27 +630,19 @@
     int rc = VINF_SUCCESS;
     char szCurDir[RTPATH_MAX];
+    /* Construct current path. */
     if (RTStrPrintf(szCurDir, sizeof(szCurDir), pszRootDir))
     {
         if (pszSubDir != NULL)
             rc = RTPathAppend(szCurDir, sizeof(szCurDir), pszSubDir);
-        if (RT_SUCCESS(rc) && pszFilter != NULL)
-            rc = RTPathAppend(szCurDir, sizeof(szCurDir), pszFilter);
     }
     else
         rc = VERR_NO_MEMORY;
 
-    if (pszFilter)
-        rc = RTDirOpenFiltered(&pDir, szCurDir,
-#ifdef RT_OS_WINDOWS
-                               RTDIRFILTER_WINNT);
-#else
-                               RTDIRFILTER_UNIX);
-#endif
-    else
+    if (RT_SUCCESS(rc))
+    {
+        /* Open directory without a filter - RTDirOpenFiltered unfortunately
+         * cannot handle sub directories so we have to do the filtering ourselves. */
         rc = RTDirOpen(&pDir, szCurDir);
-
-    if (RT_SUCCESS(rc))
-    {
-        for (;;)
+        for (;RT_SUCCESS(rc);)
         {
             RTDIRENTRY DirEntry;
@@ -692,33 +684,42 @@
                 case RTDIRENTRYTYPE_FILE:
                 {
-                    char *pszFileSource = NULL;
-                    char *pszFileDest = NULL;
-                    if (RTStrAPrintf(&pszFileSource, "%s%s%s",
-                                     pszRootDir, pszSubDir ? pszSubDir : "",
-                                     DirEntry.szName) >= 0)
+                    bool fProcess = false;
+                    if (pszFilter && RTStrSimplePatternMatch(pszFilter, DirEntry.szName))
+                        fProcess = true;
+                    else if (!pszFilter)
+                        fProcess = true;
+
+                    if (fProcess)
                     {
-                        if (RTStrAPrintf(&pszFileDest, "%s%s",
-                                         pszSubDir ? pszSubDir : "",
-                                         DirEntry.szName) <= 0)
+                        char *pszFileSource = NULL;
+                        char *pszFileDest = NULL;
+                        if (RTStrAPrintf(&pszFileSource, "%s%s%s",
+                                         pszRootDir, pszSubDir ? pszSubDir : "",
+                                         DirEntry.szName) >= 0)
                         {
+                            if (RTStrAPrintf(&pszFileDest, "%s%s",
+                                             pszSubDir ? pszSubDir : "",
+                                             DirEntry.szName) <= 0)
+                            {
+                                rc = VERR_NO_MEMORY;
+                            }
+                        }
+                        else
                             rc = VERR_NO_MEMORY;
+
+                        if (RT_SUCCESS(rc))
+                        {
+                            rc = ctrlCopyDirectoryEntryAppend(pszFileSource, pszFileDest, pList);
+                            if (RT_SUCCESS(rc))
+                                *pcObjects = *pcObjects + 1;
                         }
+
+                        if (pszFileSource)
+                            RTStrFree(pszFileSource);
+                        if (pszFileDest)
+                            RTStrFree(pszFileDest);
                     }
-                    else
-                        rc = VERR_NO_MEMORY;
-
-                    if (RT_SUCCESS(rc))
-                    {
-                        rc = ctrlCopyDirectoryEntryAppend(pszFileSource, pszFileDest, pList);
-                        if (RT_SUCCESS(rc))
-                            *pcObjects = *pcObjects + 1;
-                    }
-
-                    if (pszFileSource)
-                        RTStrFree(pszFileSource);
-                    if (pszFileDest)
-                        RTStrFree(pszFileDest);
-                    break;
-                }
+                }
+                break;
 
                 case RTDIRENTRYTYPE_SYMLINK:
