asp.net get all subdirectories and files under the specified folder (tree) _ Practical Tips
Source: Internet
Author: User
#region get all subdirectories and files under the specified folder (tree)
/****************************************
* Function Name: Getfoldall (String Path)
* Function Description: Get all subdirectories and files under the specified folder (tree form)
* Parameter: Path: detailed path
* Call Columns:
* String strdirlist = Server.MapPath ("templates");
* this. Literal1.text = EC. Fileobj.getfoldall (strdirlist);
*****************************************/
<summary>
Get all subdirectories and files under the specified folder
</summary>
<param name= "path" > Detailed path </param>
public static string Getfoldall (String Path)
{
<summary>
Gets all subdirectories and file functions under the specified folder
</summary>
<param name= "Thedir" > specified directory </param>
<param name= "Nlevel" > Default starting Value, when called, typically 0</param>
<param name= "Rn" > the incoming value for the iteration, generally null </param>
<returns></returns>
public static string Listtreeshow (DirectoryInfo thedir, int nlevel, string Rn)//recursive directory file
{
directoryinfo[] subdirectories = thedir.getdirectories ()//Get Directory
foreach (DirectoryInfo dirinfo in subdirectories)
{
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service