diff --git a/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_search.java b/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_search.java
index 32137e52..de385ef4 100644
--- a/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_search.java
+++ b/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_search.java
@@ -64,15 +64,16 @@ public class stdapi_fs_search implements Command {
 
     public static List findFiles(String path, String mask, boolean recurse, Integer startDate, Integer endDate) {
         try {
-            File pathfile = Loader.expand(path);
-            if (!pathfile.exists() || !pathfile.isDirectory()) {
-                pathfile = new File(path);
-                if (!pathfile.exists() || !pathfile.isDirectory()) {
+            File pathFile = Loader.expand(path);
+            if (!pathFile.exists() || !pathFile.isDirectory()) {
+                pathFile = new File(path);
+                if (!pathFile.exists() || !pathFile.isDirectory()) {
                     throw new IOException("Path not found: " + path);
                 }
             }
-            path = pathfile.getCanonicalPath();
-            String[] lst = new File(path).list();
+            path = pathFile.getCanonicalPath();
+            pathFile = new File(path);
+            String[] lst = pathFile.list();
             List glob = new ArrayList();
             if (lst == null) {
                 return glob;
@@ -81,7 +82,7 @@ public class stdapi_fs_search implements Command {
                 if (lst[i] == null) {
                     continue;
                 }
-                File file = new File(lst[i]);
+                File file = new File(pathFile, lst[i]);
                 if (recurse && file.isDirectory()
                         // don't follow links to avoid infinite recursion
                         && file.getCanonicalPath().equals(file.getAbsolutePath())) {