Mobile delete file with specific file extension

hi,

i am currently working on an App that stores mp4 files in the Persistent Data Path of the application. How can i find all files with the .mp4 extension and delete them?

edit: the problem is. I dont know the exact filenames. They look like: 43.mp4 or 3279.mp4

Hi,

you can use this code:

string[] files = System.IO.Directory.GetFiles( YourPath, "*.mp4", SearchOption.AllDirectories);

foreach( string filepath in files)
{
    System.IO.File.Delete( filepath ));
}