The copy/folder file activity helps with duplicating resources in the system folders from one place to another.
uses System.IOUtils.TDirectory.Copy
uses System.IOUtils.TFile.Copy
Activity properties
begin if TDirectory.Exists('C:\...\Codolex\TestData') then TDirectory.Move('C:\...\Codolex\TestData', 'C:\...\Codolex\TestDataMoved'); end; |
Resulting code
By default the folder option is selected. When a folder is copied, all nested files and folders are also copied.
To move a single file, use the file option.
Source and destination path must be provided, and must be valid folder or file paths, otherwise the generated code will result in an error.
The option 'do when folder exists' provides the ability to check if the source folder exists before copying the folder.
If the destination folder does not exist, a folder will be created.
If the destination folder does exist, the nested files and folder will be copied into the existing folder.
Files that are already present will not be overwritten.
For files, there are some extra options.
The option 'do when file exists' provides the ability to check if the source file exists before copying the file.
The other options must be used exclusively and determines if the file must be overwritten or skipped if it already exits.