Examples of use - File system

This is an example that shows how to use the following steps:

We create a string variable named FolderPath to store the folder path "C:\RPA\".

We have two folders in our directory named "Finish" and "Working".

Get Folders in Folder Step

 

Lets use "Get Folders in Folder Step" as input to retrieve folders using our FolderPath variable. 

 

The ListOfStrings variable AllFolders contains two items in the list::


0. Finish


1. Working

 

Input and Output variables:

 

 

Concatenate the folder path with the working folder to create the new variable FolderName with value "C:\RPA\Working". Check examples of use- text steps for more information.

 

Get Files in Folder Step

 

Let's use the "Get Files in Folder Step" to retrieve the excel file in the Working folder.

 

If you don't know the exact name of the Excel file, you can search for any file with the extension .xlsx by using the search term *.xlsx, where the asterisk represents any name. For instance, if you know that the name of your file includes the word "demo," you can search for *demo*.xlsx. Our ExcelFile will now be list of strings with only one element, containing the full path of the searched file.

 

Get Files In Folder Step

To read the data from the list, we will use the "Read String From List" step.

 

Input and Output variables:

 

Get Files In Folder Step

 

To read the data from the list, we will use the "Read String From List" step.

 

Get File Extension Step

 

To get file extension, we use "Get File Extension Step".

 

Input and Output variables:

 

 

Empty Folder Step

 

Now we will empty Finish folder using "Empty Folder Step".

 

Move Copy File Step

 

Our Finish folder is empty now. Let's use the "Move Copy File Step" to copy the file to the Finish folder. Now, we have a copy of our Excel file in the Finished folder.

 

 

Rename File Step

 

Now we will rename our copied excel file to name "New excel name" in the "Rename File Step"

 

After the execution of the process, the current situation in our "Finish" folder is as follows:

 

 

Delete File Step

 

If you wish to delete a file, use the "Delete file Step". We will use this step to delete our Excel file.

File Exists Step

 

We will now utilize the "File Exists Step" to verify the existence of a file. The result of this step will be saved in a boolean variable called FileExists. The boolean variable has a value of "False" because in the previous step, we deleted that file.

 

 

 

Extract Zip File / Compress Folder To Zip File Steps

 

Let's compress the Working folder, extract it and save both folders in "C:\RPA".

 

 

 

After the execution of the process:

 

Read Text From File Step

 

Let's go to the Working folder and create a document called FileDocument.txt. In this file, we will write "Greetings to our new colleague Robotiq.ai".

 

 

With "Read Text From File Step" we will read text in created file and store it in the new variable FileText.

 

Input and Output variables:

 

 

Write Text To File Step

 

To add new text to an existing file, you can use the "Write Text to File Step". 

 

To see the text saved in the 'FileDocument.txt' file, we will take a screenshot.

Save Screenshot Step

 

Now the robot will take a screenshot and save it as Schreenshot.png in the Working folder. 

If you run the robot multiple times, the picture will be overwritten.

 

The full path to our screenshot picture is saved in the variable SavedScreenshot: "C:\RPA\Working\Screenshot.png".

 

 

 

Was this article helpful?