How many ways we can DELETE a File in UiPath
When the use of a certain file in the automation process is completed then we have to delete that file.
In this post we will see two different ways to achieve this:
First method is by using the UiPath Activities
Activity Name: Delete File.
By using this Activity you can pass the path of the file which need to be deleted as shown below:
This is a pretty straight forward approach of deleting file in UiPath
Now we will see the second approach where we use the Invoke Method for Deleting a fie.
Activity Name: Invoke Method.
- Take an Invoke Method Activity and set the Target Type as Microsoft.VisualBasic.FileSystem
- Now write the Method Name which is Kill.
- Now we need to pass the path of the file which is going to be deleted.
- Go to properties panel of Invoke Method Activity and in parameter property create an input argument and pass the file path as shown below.
Where filepath refers to the actual path of the file.
That’s it Now execute this method you will be able to delete the required file.
From this post you have learned two ways of deleting a file in uipath.
Any feedback will be very appreciated and gives us more ideas on which topics to focus more on.