Delete all files of a directory

Hi!

In the end of my process, I need to clean (delete) all the files on the directory “downloads”. Can I do that? Thaks for helping me!

yes
–use a assign activity like this
arr_filepath = Directory.GetFiles(“yourfolderpath”)
where arr_filepath is a variable of type array of string
–now use a FOR EACH activity and pass the above array variable as input and change the type argument as string in the property panel of for each activity
–inside the loop use a DELETE activity where in the input mention as item
which will delete the files in the mentioned folder

Cheers @Giulia_G

2 Likes

Thanks!

You could do in one line like this if preffered (inside invoke code c# window):
new System.IO.DirectoryInfo(@"C:\Temp").EnumerateFiles().ToList().ForEach(f => f.Delete());

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.