Robot Task Activities - Folder
The Folder activities create, copy, move, empty, delete, list and wait for folders.

The activities run in the desktop session of the Robot Task, as the user logged on to that session, so that user needs permission on every path used, including permission to delete for Delete Folder and Empty Folder. Variables are resolved in every path field.
Several activities write their outcome to a Result property, in the Properties pane under Output. The value is an RPA variable that exists while the Robot Task runs, used in later activities as {RPA(VariableName)}.
Copy Folder
Copies the contents of a folder, with all its subfolders and files, into a destination folder. Create the destination folder first if the source has no subfolders; otherwise the copy fails.
- Source folder: the full path of the folder to copy
- Destination folder: the full path of the folder the contents are copied into
Files that already exist in the destination are replaced without warning.
Create Folder
Creates a folder, including any missing parent folders. A folder that already exists is not an error.
- Folder path: the full path of the folder
Delete Folder
Deletes a folder.
- Folder path: the full path of the folder
- Recursive: checked by default, which deletes the folder with all its subfolders and files; when cleared, the activity fails if the folder is not empty
Deleted files and folders are not moved to the Recycle Bin and cannot be restored. Because Recursive is checked by default, a new Delete Folder removes everything below the folder.
Empty Folder
Deletes all files and subfolders in a folder, and leaves the folder itself in place.
- Folder path: the full path of the folder
Deleted files and subfolders are not moved to the Recycle Bin and cannot be restored.
Folder Exists
Checks whether a folder exists and writes the result to the Result variable: "True" if the folder exists, and "False" if it does not.
- Folder path: the full path of the folder to check
- Result: in the Properties pane, the name of the variable the result is written to
Example: branching on whether a folder exists
Setting Result to Exists makes the outcome available as {RPA(Exists)}.
To check whether the folder C:\Testing\RPA\FolderExists is present, then delete it if it is and create it if it is not:
- Add a Folder Exists activity with Folder path set to
C:\Testing\RPA\FolderExistsand Result set toExists. - Add an If (simple) activity after it, with Left operand
{RPA(Exists)}, Operator "Equal", Right operand "True" and Type "String". - In the Then body, add a Delete Folder activity with the same folder path and Recursive checked.
- In the Else body, add a Create Folder activity with the same folder path.
The result is written as the text "True" or "False", so a "String" comparison with "True" works.
Move Folder
Moves a folder and its contents to a new location. The move fails if the destination folder already exists.
- Source folder: the full path of the folder to move
- Destination folder: the full path the folder is moved to
Open Folder
Opens a folder in File Explorer.
- Folder path: the full path of the folder
Rename Folder
Gives a folder a new name in the same parent folder.
- Folder path: the full path of the folder
- New name: the new folder name
Touch Folder
Creates the folder if it does not exist, and sets its last access time to the current time. The last write time is not changed.
- Folder path: the full path of the folder
Get Folders
Finds the folders that match a folder filter and runs the Body once for each one, with the full folder name. It works like a For Each loop over the matched folders.
- Folder path variable name: the name of the variable the full folder name is written to on each iteration
- Folder filter: opens the folder filter window, used to choose which folders match; see Folder filter
- Body: the activities that run for each matched folder
Use {RPA(FolderName)} in the child activities to get the current folder name, with the variable name you set in place of FolderName.
Wait For Folder
Waits for a folder to exist and writes the result to the Result variable: "True" if the folder appears before the time runs out, and "False" if it does not.
- Folder path: the full path of the folder to wait for
- Wait for folder: how long to wait, in milliseconds, "10000" by default
- Throw exception: when checked, which is the default, the activity fails if the folder does not appear in time
- Result: in the Properties pane, the name of the variable the result is written to
With Throw exception cleared, a folder that never appears is only written to the output, and the sequence continues. Unless a later activity tests the Result variable, the Task reports success.
Tips
- Create Folder and Touch Folder both create a missing folder and leave an existing one in place, so neither needs a Folder Exists check first
- Use Empty Folder rather than Delete Folder followed by Create Folder when you clear a working folder. It keeps the folder's permissions and any shares that point at it
- Leave Throw exception cleared on Wait For Folder and test the Result variable with an If (simple) activity when a missing folder is a case you want to handle rather than an error
- Because the Result value is the text "True" or "False", set the comparison Type to "String" in the If activity that reads it