• 如何获取文件夹下各子文件夹名,同时将这些信息输出到文本文件中呢?求赐教!


    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();///记数超过子文件夹数后,停止写入关闭流;               

          }                                    

    }      

       }   

      }

    }

    北卿~~~~
  • 相关阅读:
    灰度图像的直方图
    两幅图像的融合与叠加
    图像像素基本操作——自然系列滤镜
    图像像素加减乘除操作
    调整图像亮度、对比度、饱和度
    基于BufferedImage的图像滤镜演示
    Java——BufferedImage操作实例
    Java——BufferedImage对象
    Java——绘制五角星
    Java——自定义外部字体文件
  • 原文地址:https://www.cnblogs.com/Lxiaojiang/p/3568781.html
Copyright © 2020-2023  润新知