A specific windows folder can be easily deleted with the "Delete Folder" Action.


However, the above Action does not support wildcard characters. This means that we cannot delete a folder that starts with/ends with/contains...etc some specific text.


In order to do so, we can use the "Run VBScript" Action with the following configuration:


Dim FSO, Folder
set FSO=CreateObject("Scripting.FileSystemObject")
Folder="C:\Users\Username\Desktop\UniqueName*"
FSO.DeleteFolder(Folder)


Note that this way, wildcards (*) are also supported, so if the name of the Folder is for example "UniqueNameTodaysDate", the above command will still find and delete the folder.


Use case

There are cases where each time an application runs, it will create a folder at a specific location with a unique name.


In order to delete that folder, we could implement a logic in our process to retrieve the subfolders of a folder and then check the names of those folder one by one.


The same functionality can be easily achieved with the above method.