Method: Copy for Folder
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: Copy for Folder
Method: Copy for Folder
Copies a folder into another folder.
Object.Copy(Destination, [OverWriteFiles])
| Object | Folder Object with this method |
| Destination | String Specifies the path of the target folder to which DIAdem copies the source folder. The path of the target folder must not contain wildcards. If the target is an existing file, an error occurs. |
| [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 copy 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 the complete folder Example\Documents below the DIAdem program folder to the folder C:\Temp\Documents:
Sub CopyEntireFolder(sSource,sTarget,bOverwrite) Dim fso, oMyFolder Set fso = CreateObject("Scripting.FileSystemObject") set oMyFolder = fso.GetFolder(sSource) Call oMyFolder.Copy(sTarget,bOverwrite) End Sub Call CopyEntireFolder(ProgramDrv & "Examples\Documents", "c:\Temp\Documents",True)
