List of all files that are within the Resource.Raw folder

Asked

Viewed 558 times

1

How to get all the files that are in the Resource folder and move to a list.

I am doing it manually, but now I need to take it dynamically and move to a list all the files that are in the Resource.Raw folder

string[] caminho = new string[2];
caminho[0] = "android.resource://" + PackageName + "/" + Resource.Drawable.a;
caminho[1] = "android.resource://" + PackageName + "/" + Resource.Drawable.b;

1 answer

0

Something like this could solve:

var files = Directory.GetFiles("android.resource://" + PackageName + "/", "*.*")
            .Where(s => s.EndsWith(".mp4"));
var caminho = new List<string>();
foreach (var item in files)
{
     caminho.Add("android.resource://" + PackageName + "/" + item);
}
  • Directory to grab all files from your directory (change as needed).
  • Foreach to fill a list of your files.
  • After knowing the names of the files that are in the folder how do I concatenate the full address of the folder with the names of the files?

  • Thiago only reinforcing what I really want is to get all the mp4 files from the folder with their full addresses as they will all play.

  • Good morning Luiz, I changed the function to get only files . mp4, and then add in the list the already concatenated files... Just check to see if this is the way to go.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.