Automation testing QTP with VB Script functions Interview questions


Total available count: 68
Subject - Software Testing
Subsubject - Automation testing QTP with VB Script functions

Method: CopyFile?

 It copies one or more files from one location to a new location.

Syntax: fso.CopyFile (source, destination[, overwrite]).

Arguments:
fso: (Required) The name of a FileSystemObject object previously instantiated.
source: (Required) A character string file specification, which can include wildcard characters, for one or more files to be copied.
destination: (Required) Character string destination where the file or files from source are to be copied.Wildcard characters are not allowed in the destination string.
overwrite: (Optional) Boolean value that indicates if existing files are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite.

Example: 

Set fso=createobject("Scripting.FileSystemObject")
'File to be copied Sourcefile="C:copy.txt"'Dest folder where the file has to be copied.
Destination="D:final1"
'If the destination doesnot exist then create the destination folder.
If fso.FolderExists(Destination) = false Then   
fso.CreateFolder (Destination)
End If  
'Copy the file 
fso.CopyFile Sourcefile,Destination,True
Set fso=nothing

 




Next 5 interview question(s)

1
Method: DeleteFile?
2
Method: CreateFolder?
3
Method: CopyFolder?
4
Method: MoveFolder?
5
Method: DeleteFolder?

Comments