Copies an existing file to a new file.
object.Copy ( ExistingFileName, NewFileName [,FailIfExists] ) |
- ExistingFileName
- Required. A String that represents the full path of the file to be copied.
- NewFileName
- Required. A String that represents the full path of the destination file to copy to.
- FailIfExists
- Optional. A Boolean that specifies whether to abort the copy if the destination file already exists.
Boolean
FailIfExists is a boolean specifying whether to abort the copy if the destination file already exists. If not specified, FailIfExists is False. [Optional].
File.Copy Example (VBScript) | Copy Code |
---|---|
'Variables Dim GPSfile, origFile, newFile, timeString 'Create File Object. This enables you to copy files Set GPSfile = Application.CreateAppObject("file") 'Set the variables to the correct location and file name origFile = preferences.properties("datapath") & "\GPSCorrect.ssf" newFile = preferences.properties("datapath") & "\GPSCorrect_" & now & ".ssf" timeString = hour(now) & minute(now)& second(now) 'Check to see if the GPS correct file exists, if not then its business as usual if GPSfile.exists(preferences.properties("datapath") & "\GPSCorrect.ssf") = true then origFile = preferences.properties("datapath") & "\GPSCorrect.ssf" newFile = preferences.properties("datapath") & "\GPSCorrect_" & timeString & ".ssf" Call GPSfile.Copy(origFile,newFile) end if |