using System;
using System.Collections.Generic;
using System.Linq; using System.Data;
using System.Configuration;
using System.Collections;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
namespace zheng_li
{ class Program
{
static void Main(string[] args)
{
string path = @"F:data_allDaZhongDianPingBeiJing_dazhongDaZhongDianPing_yonghuinx86Debug用户点评";///根文件夹地址
DirectoryInfo dif = new DirectoryInfo(path);///文件夹实例
FileSystemInfo[]fsis = dif.GetFileSystemInfos();////获取子文件夹
string path1 = @"F:data_allce_shi.txt";///定义新的文件路径
FileInfo f1 = new FileInfo(path1);
f1.Create();///创建文件
int count=0;
foreach (FileSystemInfo fsi in fsis)
{ DirectoryInfo dif1 = new DirectoryInfo(fsi.FullName);
string str = dif1.Name;///子文件夹名
Console.WriteLine(str);
FileStream fs = new FileStream(path1, FileMode.Open,FileAccess.ReadWrite);
StreamWriter sr = new StreamWriter(fs);
sr.Write(str);///流写入创建的文件中
count += 1; //// 记数,一共多少个子文件夹
if(count>7254)
{ sr.Close();
fs.Close();///记数超过子文件夹数后,停止写入关闭流;
}
}
}
}
}