- using System.IO;
-
-
-
-
-
- public string GetAllFolder(string path)
- {
- string folder_Names = "";
- DirectoryInfo dir = new DirectoryInfo(path);
-
- foreach (DirectoryInfo subdir in dir.GetDirectories())
- folder_Names += subdir.FullName + ",";
-
- return folder_Names;
- }
using System.IO;
/// <summary>
/// 获取指定目录下的所有文件夹名
/// </summary>
/// <param name="path">目录路径</param>
/// <returns>string,返回所有文件夹名字</returns>
public string GetAllFolder(string path)
{
string folder_Names = "";
DirectoryInfo dir = new DirectoryInfo(path);
foreach (DirectoryInfo subdir in dir.GetDirectories())
folder_Names += subdir.FullName + ",";
return folder_Names;
}
- using System.IO;
-
-
-
-
-
- protected long GetDirectorySize(string path)
- {
- long dirSize = 0;
- DirectoryInfo dir = new DirectoryInfo(path);
- foreach (FileInfo file in dir.GetFiles())
- dirSize += file.Length;
- foreach (DirectoryInfo subdir in dir.GetDirectories())
- dirSize += GetDirectorySize(subdir.FullName);
- return dirSize;
- }