DIAdem Help

Method: CopyFile for FileSystemObject

  • Updated2024-09-12
  • 2 minute(s) read

Method: CopyFile for FileSystemObject

Copies one or more files to a different folder or to another file.

Object.CopyFile(Source, Destination, [OverWriteFiles])
ObjectFileSystemObject
Object with this method
SourceString
Specifies the path of the files that you want to copy. The path may contain wildcards in the last path component. If the source contains wildcards, the target path must lead to an existing folder.
DestinationString
Specifies the path of the target folder or the target file to which DIAdem copies the source file. The path of the target folder or the target file must not contain wildcards.
[OverWriteFiles]Boolean
Specifies whether DIAdem overwrites existing files. If the value is True, DIAdem overwrites existing files. If the value is False, DIAdem does not overwrite existing files. The default value is True.
Note  The CopyFile method aborts as soon as the first error occurs. DIAdem does not undo changes made to the file system before an error occurred.

The following example copies all TDR files from the folder Example\Documents below the DIAdem program folder to the folder C:\Temp:

Sub CopyMyFile(sSource,sTarget,bOverwrite)
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  Call fso.CopyFile(sSource,sTarget,bOverwrite)
End Sub
Call CopyMyFile(ProgramDrv & "Examples\Documents\*.tdr", "c:\Temp",True)

See Also

Objects Overview

Log in to get a better experience