Skip to main content

Copy-File

Command Description

Specify a file path and copy the file to the path

Command Prototype

File.CopyFile(sPathSrc,sPathDst,bOverWrite)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathSrcTruepath'''C:\Users'''The copied file path can be an absolute path, or you can use @res path format to indicate the current path of the process. You need to do escape the path separator character,For example: "C:\Laiye RPA" or @res"Laiye RPA\Laiye RPA"
sPathDstTruepath'''C:\Users'''Copied folder path can be absolute path. And can also use @res "path" form to represent path under current process res folder. Path separator needs to be escaped, like: "C:\Laiye RPA" or @res"Laiye RPA\Laiye RPA"
bOverWriteTruebooleanNoneCan select whether to replace a file of the same name during the copying process. Default is No

Demo

/************************************Copy file************ ************************ 
Command prototype:
File.CopyFile('''C:\Users''','''C:\Users''',false)
Input parameters:
sPathSrc--the copied file path
sPathDst--the folder path to copy to
bOverWrite--When copying a file with the same name, you can choose whether to replace it, the default is no
Outgoing parameters:
None
********************************************************************************/
Dim sPathSrc='''C:\Users\Chance\Desktop\testFile\data.txt'''
Dim sPathDst='''C:\Users\Chance\Desktop\testFile\tempCopy'''
File.CopyFile(sPathSrc,sPathDst,false)