preload

How to check if folder exists (QTP, VBScript)

Posted by Albert Gareev on Jan 24, 2010 | Categories: File System OperationsHow to

Parent page: Service Functions – System (QTP, VBScript)

Use FileSystemObject.FolderExists method.
Argument should be a full path string.

 
When to use it? Always before trying to access the folder (delete, rename, or read from) or create files in it.

Note. Always release the object you created when you no longer need it. If you don’t do that then in the long run it’ll cause you memory leakage problem.


Set FSO = CreateObject("Scripting.FileSystemObject")
boolRC = FSO.FolderExists(sFolderName)
Set FSO = Nothing 'release an object
If Not boolRC Then
'do what you need to do if
'folder does not exist
End If


  • One response to "How to check if folder exists (QTP, VBScript)"

  • mohit
    22nd December 2016 at 0:01

    how to retrive first link of site and save it to datatable in qtp

    [ Albert’s note. How to post a random comment and not receive an answer. ]

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.