How can I do to list only the name of a folder that is inside a root folder?
Example:
Pasta raiz C:/Downloads
SubPastas: Teste/ Teste 2
InmyDLLIcanlistthefoldershoweverwiththeirfullpath,Iwouldjustliketolistthenameofthesubfolders:
IncaseonlyTeste
andTeste2
Followthecodebelow:
privatevoidcarregarFolders(){try{stringcaminho=@"C:/Downloads";
ddlFolders.DataSource = Directory.GetDirectories(caminho);
ddlFolders.DataValueField = "";
ddlFolders.DataTextField = "";
ddlFolders.DataBind();
ddlFolders.Items.Insert(0, new ListItem(string.Empty, string.Empty));
}
catch (Exception ex)
{
throw ex;
}
}