How to delete set of files in a folder

Hi guys,

Delete files starting with “Temp” in a folder in one go.

I know this can be achieved by running a loop on items in folder but I want to achieve it without loop.

How this can be done?

Also, is there way, we can delete multiple files using Delete activity in uipath or any other activity?


Why are you trying to avoid a loop? It’s the proper way to do it.

HI @postwick,

Bcoj it might not be quicker when there are thousands to such files, hence looking for an alternative way.


Hello @sonaliaggarwal47!

I found this on the forums. Would a modified version of this help at all?

The part that takes any time is the actual deletion of the files, not the loop. Either way you’re still deleting thousands of files.


Try as below, Use Invoke Code and write as below

Array.ForEach(Directory.GetFiles("FolderPath"), Sub(X) File.Delete(X))

Hope this may help you