How To Check Whether Particular File and Folder Exists or Not in QTP?

QTP Script to check whether specified file and folder exist or not.

Data Driven Testing

Datatable Methods

Script to check particular text file exists or not.

Dim f1
Set f1 = CreateObject("Scripting.FileSystemObject")
If (f1.FileExists("D:\lakshmi.txt")) Then
Msgbox "file exists"
Else
Msgbox "file doesn't exist"
End If

FileExists Method:Returns True if a specified file exists,False if it does not.

Syntax:object.FileExists(filespec)

Above script checks text file("lakshmi")in D drive.
If text file is present "file exists" message is displayed else "file doesn't exist" message will be displayed.


Script to check particular folder exists or not.

Dim f1
Set f1 = CreateObject("Scripting.FileSystemObject")
If (f1.FolderExists("C:\laxmi")) Then
Msgbox "folder exists"
Else
Msgbox "folder doesn't exist"
End If

FolderExists Method:Returns True if a specified folder exists,False if it does not.

Syntax:object.FolderExists(folderspec)

Above script checks folder("laxmi")in C drive.
If folder is present "folder exists" message is displayed else "folder doesn't exist" message will be displayed.

SQL Queries Collection
Movie Songs Lyrics
How to Move a File From One Location to Another in QTP?
How to copy a file and folder from one location to other in QTP?
Export Database Data to ExcelSheet

How to Move a File From One Location to Another in QTP?

Script to copy a file and folder from one location to other in QTP


Script for moving a file from One location to Another location in QTP?


Dim f
Set f = CreateObject("Scripting.FileSystemObject")
f.MoveFile "D:\laxmi.txt", "C:\"
Msgbox "File Moved"


Above script is for moving a text file(laxmi)from D drive to C drive.


The MoveFile method takes two parameters,the source file and the destination.


Syntax:object.MoveFile (source,destination)


My Article in Ezine Articles

Data Driven Using Notepad

Script to copy a file and folder from one location to other in QTP

SQL Queries Collection

Movie Songs Lyrics

Manual Testing Faqs

How to Copy a File and Folder From One Location to Other in QTP?

Script for copying a file from One Folder to Another Folder in QTP?

Dim f
Set f = CreateObject("Scripting.FileSystemObject")
f.CopyFile "C:\lakshmi.txt", "D:\"
Msgbox "File Copied"

Above script is for copying a text file(lakshmi)from C drive to D drive.

The CopyFile method,performs the file copy operation.

The CopyFile method takes two parameters,the source file and the destination.

My Article in Ezine Articles

Data Driven Using Notepad

Script to Create Text File

Script to Delete File

Script to Copy a folder from one drive to other in QTP.

Dim f
Set f = CreateObject("Scripting.FileSystemObject")
f.CopyFolder "D:\Test2", "C:\"
Msgbox "Folder Copied"

Above script is for copying a Folder(Test2)from D drive to C drive.

The CopyFolder method,performs the folder copy operation.

The CopyFolder method takes two parameters,the source folder and the destination


QTP Script to Get Names of Subfolders in a Folder.

SQL Queries Collection

Movie Songs Lyrics

Script to Create Folder

My Article in Ezine Articles

My Article got published in Ezine Articles.


Check My First Article in EzineArticles.Com.


I WISH U ALL A VERY HAPPY AND PROSPEROUS NEW YEAR !!!



Software Testing Faqs


Data Driven Testing in QTP

Datatable Methods

QTP Script for different Controls

Script to Capture Tooltip

VBScript Functions With Examples


QTP Script to Check All Checkboxes in a Webpage

Data driven testing using datatable

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge