I'm trying to get the items from within a folder on an Android phone.
However the FolderBrowserDialog won't let me select a folder from within in the phone. The path looks like this This PC\Xperia Z3 Compact\SD Card\Music
To select a folder I'm currently using:
private void button_Click(object sender, EventArgs e)
{
System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
UserFolderLocation = dlg.SelectedPath;
}
else { }
}
Then when searching the folder for its contents I use:
try
{
folderItems = Directory.GetFiles(directory).Select(f => Path.GetFileNameWithoutExtension(f)).ToArray();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
If I insert the path This PC\Xperia Z3 Compact\SD Card\Music
as a variable then search it, it throws a System.IO.DirectoryNotFoundException
.
How do I select and use a path that doesn't begin with c:
, d:
etc?