Showing posts with label files in qtp. Show all posts
Showing posts with label files in qtp. Show all posts

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 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

QTP Script to Get Created Date and Time,Modified Date and Time & Accessed Date and Time of a File.

How to get created date and time of a particular file?

Set f1 = CreateObject("Scripting.FileSystemObject")
Set f2 = f1.GetFile("E:\Lak.txt")
S = "File was Created on: "&f2.DateCreated
Msgbox S

Output->File was Created on: 10/12/2008 3:45:16 PM

How to get last Modified date and time of a particular file?

Set f1 = CreateObject("Scripting.FileSystemObject")
Set f2 = f1.GetFile("E:\Lak.txt")
S = "File was Last Modified on: "&f2.Datelastmodified
Msgbox S

Output->File was Last Modified on: 10/12/2008 3:51:24 PM

How to get last accessed date and time of a particular file?

Set f1 = CreateObject("Scripting.FileSystemObject")
Set f2 = f1.GetFile("E:\Lak.txt")
S = "File was Last Accessed on: "&f2.Datelastaccessed
Msgbox S

Output->File was Last Accessed on: 10/12/2008 3:55:15 PM


Movie Songs Lyrics

SQL Queries

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge