Please enable JavaScript to view this site.

Codolex

Navigation: Activities > File system

Move file/folder

Scroll Prev Top Next More

The move file/folder activity moves files and folders from one place to another on the local file system

Uses System.IOUtils.TDirectory.Move

Uses System.IOUtils.TFile.Move

 

clip0066

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 moved, all nested files and folders are also moved. After moving, the old folder is deleted.

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.

 

Folder

The option 'do when folder exists' provides the ability to check if the source folder exists before moving 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 moved into the existing folder.

Files that are already present will not be overwritten.

 

File

For files, there are some extra options.

MoveFileOptions

 

The option 'do when file exists' provides the ability to check if the source file exists before copying the file.

The option 'Skip when file exists' determines if the file must be overwritten or skipped if it already exits.

© by GDK Software