Delete files with certain words in the name

Hello all,

I have a process that uploads image files.
I use a get file list for it but I need to delete image files that contain “new image” in the file name.

How would i make such a process?

@dvn If the Images are contained in a Folder, you can use :
Directory.GetFiles(yourFolderPath) to get the files in that folder.

Then using an If condition you can check whether there is “new image” in the name, If present you can use Delete File Activity

Afraid i dont get it.
What kind of condition would i write in the IF part and what would i write for the Delete File activity?

@dvn Sorry I missed the part that you’ll need to use For Each of the Output of Directory.GetFiles() which will be an array of String :sweat_smile:

The Workflow will look Something like this :
Assign : strArray = Directory.GetFiles(yourFolderPath)
For Each item in strArray
if item.ToString.ToLower.Contains(“new image”)
Delete File Activity
leave Blank

1 Like

Hi , Thaks for your report ! How can we do if we want to not delete if contains…

Just put the ‘delete file’ activity on the other side of the if condition…