How to delete files in a folder power automate desktop
While designing process automation we tend to store a lot of files that may be either input files or output files.
But after the process execution or some working days, we need to delete all those saved files from the project folder.
There are two main reasons for doing this because that might take more storage and the other one is to take a new file as input every time.
Because of these reasons, this step is one of the important steps to verify before completing the design of process automation.
In this article, we will see how to delete files in a folder using power automate desktop.
Let’s get into the practical implementation of this task:
There are two different scenarios here, they are mentioned below:
- Delete a single file
- Delete multiple files in a folder
First let’s see how to delete a single file:
Step1: Drag and Drop Delete file(s) action from actions panel to flow designer panel as shown below:
Let’s see the required parameters for this delete file(s) action:
- File(s) to delete – Provide the full file path of the file that needs to be deleted
Now the below image shows all the parameters that required to that action:
It will delete the file that is provided as input to this action.
Now let’s see for deleting multiple files from a folder:
Step1: Drag and Drop Get files in folder action from actions panel to flow designer panel as shown below:
Here it will give us the list of files in that folder.
Let’s see the required parameters for get files in folder action:
- Folder – Provide the full path of the folder where it moves all the files in that folder.
- File filter – If you want to get specific types of files from that folder then a filter can be given here. (eg: If we want only text files to be moved then use like this *.txt or if you want multiple files to be included then use as this *.txt;*.jpg)
- Files – This is the output which is a list that holds all the file paths.
Step2: Drag and Drop the delete files action from actions panel to flow designer panel as shown below:
We already discussed about all the required parameters for this action.
Instead of providing the file path just pass the list of files variable as shown in the above image.