Forum Discussion

mspatel's avatar
mspatel
Contributor
10 years ago
Solved

FileExists aand FindFiles failed when No file in Folder TestComplete

aqFileSystem.FindFiles("C:\Temp\" , "*.zip" ) .count failed when there is no file or Folder in the Target Folder.  It complains about "Object Doesnt Exist " or something...Shouldnt it Return NU...
  • Andrey_M's avatar
    10 years ago
    Hi.



    Here is working piece of code.






    Sub testFiles


    Dim countFiles


    Set countFiles = aqFileSystem.FindFiles("C:\Temp\" , "*.zip" )


    If countFiles Is Nothing Then


      Log.Message ( "No files found" )


    Else


      For I = 0 To countFiles.Count - 1


        Log.Message( countFiles.Item( I ).Name )


      Next   


    End If  


    End Sub