How to delete files in folder

Hi
Need help. How to delete files in folder which are files name dose not contain key words?

Hi @Rashidi_Ahmad , you can use directory.get files() to get list of all files in a directory. Then you can use an if condition inside a loop to delete files that do not have names as required.

Hi @Rashidi_Ahmad
Please refer to the screenshot of the xaml attached below.

  1. In if condition use the desired condition of the keyword.
1 Like

Check this
it can help you

1 Like

Hi, @Rashidi_Ahmad you can use directory.getfiles(path,“*”) and use for each loop and use delete activity and use item.tostringimage

1 Like

Hi @Rashidi_Ahmad - you can use not contain keyword as shown below…

Code : Directory.GetFiles(FolderPath).Where(Function(n) not path.GetFileName(n).Contains(YourKeyword)).ToArray

Please try like this…

2 Likes

Thanks it works as what i need. Thanks a lot

1 Like

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