How can I delete files from one folder per extension? "I got" the files with this code:
string[] arquivos = Directory.GetFiles(st.path, "*.xml", SearchOption.AllDirectories);
But I do not know how to delete
How can I delete files from one folder per extension? "I got" the files with this code:
string[] arquivos = Directory.GetFiles(st.path, "*.xml", SearchOption.AllDirectories);
But I do not know how to delete
Because you have a collection of string
s with the paths of the files, you can use the Delete
" of class File
.
foreach(var arq in arquivos)
{
File.Delete(arq);
}