Forum Discussion

rmnrdi's avatar
rmnrdi
Contributor
6 years ago
Solved

FindFiles not working

This line of code is not finding a file and returning null.

 

foundFiles = aqFileSystem.FindFiles("C:\\Temp\\" , "*.rxi");

//I'm using javascript, hence the escape \

 

Here is a picture of a file in that folder:

 

That code is practically copied and pasted from here:

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfilesystem/findfiles.html?q=findfiles 

 

I also tried a folder on my desktop with the same results. 

 

Anyone had this issue?

 

Any help would be greatly appreciated.

  • rmnrdi

    I did use the same code and .rxi extension file. It did work for me, please refer below...

    function FileFinder()
    {
      var foundFiles, aFile;
      foundFiles = aqFileSystem.FindFiles("E:\\UsersDirectory\\", "*.rxi");
      if (!strictEqual(foundFiles, null))
        while (foundFiles.HasNext())
        {
          aFile = foundFiles.Next();
          Log.Message(aFile.Name);
        }
      else
        Log.Message("No files were found.");
    }

     

2 Replies

  • rmnrdi

    I did use the same code and .rxi extension file. It did work for me, please refer below...

    function FileFinder()
    {
      var foundFiles, aFile;
      foundFiles = aqFileSystem.FindFiles("E:\\UsersDirectory\\", "*.rxi");
      if (!strictEqual(foundFiles, null))
        while (foundFiles.HasNext())
        {
          aFile = foundFiles.Next();
          Log.Message(aFile.Name);
        }
      else
        Log.Message("No files were found.");
    }

     

    • rmnrdi's avatar
      rmnrdi
      Contributor

      I figured out the problem.

       

      I had "hide file extensions for known file types" on.

       

      This is what it thought the file name was:

       

       

       

       Your answer is the excepted solution because looking at the picture of the log with the full file name and extension made me realize what had happend.

       

      :smileyfrustrated:

      Thanks for your help.