How to delete all .jpg from directory

I have to delete all (.jpg) from Current Directory. how to correct that.


Hi @Dinky_Girdhar ,

You have to provide folder path under directory.getdirectories(“Your folder path”). but you have given the name of the folder only i guess. thanks

Hi @Dinky_Girdhar

Use this syntax

Array_str = Directiores.getfiles("your folder path","*.jpg",System.IO.SearchOption.AllDirectories)

Pass the Array_str variable in for each acticity

Inside the for each use delete file acticity to delete all the files of jpg


1 Like

If someone else does it in their system it will give an error because we give static path



Sorry i did not understand fully your point. if you want to go dynamic you can save your folder path in config xls and you can extract dynamically from the config file and run your process. Based on the screenshot i understood that the error related to the wrong folder path you mentioned in the Directory.GetDirectories function. thanks.

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