Thread Rating:
  • 4 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i write a script in QTP to poll a folder for a new file?
#2
Solved: 11 Years, 2 Months, 2 Weeks ago
Hi,

The answer for you first question is Yes. We can verify whether a folder or a file exists using fso object

FolderExists Method:
Code:
Returns True if a specified folder exists; False if it does not.
   Dim fso, msg, fldr
   fldr = "C:\Windows"  
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FolderExists(fldr)) Then
      msg = fldr & " exists."
   Else
      msg = fldr & " doesn't exist."
   End If

FileExists Method:-
Code:
Returns True if a specified file exists; False if it does not.
The following example illustrates the use of the FileExists method.
   Dim fso, msg, filespec
   filespec = "C:\boot.ini"
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FileExists(filespec)) Then
      msg = filespec & " exists."
   Else
      msg = filespec & " doesn't exist."
   End If


-Mr.K
Reply


Messages In This Thread
RE: How can i write a script in QTP to poll a folder for a new file? - by KVK - 07-16-2009, 09:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating a folder from within a reusable action. sd3 2 3,139 06-18-2013, 03:20 PM
Last Post: learnQtptips
  How to write In PDF Form using QTP anukapoor 3 5,466 04-05-2012, 06:00 PM
Last Post: atulparate
  QTP file compare - ignoring file structure Fede 3 5,247 02-17-2012, 02:48 AM
Last Post: Parke
  Is this possbile to write the script without using the Object in object repository? njnirmal 4 8,503 01-03-2012, 05:29 PM
Last Post: shivu.hanu
Shy Help about write color text by QTP in Excel mantis 1 5,341 12-29-2011, 10:46 AM
Last Post: sshukla12

Forum Jump:


Users browsing this thread: 1 Guest(s)