最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

ASP获取磁盘D下所有txt文件路径

日期:10-14    来源:中国设计秀    作者:cnwebshow.com

using System;RYY中国设计秀
using System.Collections.Generic;RYY中国设计秀
using System.Text;RYY中国设计秀
using System.IO;RYY中国设计秀
namespace TestRYY中国设计秀
RYY中国设计秀
{RYY中国设计秀
RYY中国设计秀
class PRogramRYY中国设计秀
    {RYY中国设计秀
       RYY中国设计秀
        private static void WriteFilePath(Stream filestream)RYY中国设计秀
        {RYY中国设计秀
            StreamWriter sw = new StreamWriter(filestream);RYY中国设计秀
            DirectoryInfo dicInfo = new DirectoryInfo(@"D:");RYY中国设计秀
            FileInfo[] textFiles = dicInfo.GetFiles("*.txt", SearchOption.AllDirectories);RYY中国设计秀
            foreach (FileInfo fileInfo in textFiles)RYY中国设计秀
            {RYY中国设计秀
                sw.WriteLine(fileInfo.FullName);RYY中国设计秀
            }RYY中国设计秀
            sw.Close();RYY中国设计秀
            filestream.Close();RYY中国设计秀
            Console.Read();RYY中国设计秀
        }RYY中国设计秀
        static void Main(string[] args)RYY中国设计秀
        {RYY中国设计秀
            FileStream fs;RYY中国设计秀
            string strFilePath = @"C:path.txt";RYY中国设计秀
            if (File.Exists(strFilePath))RYY中国设计秀
            {RYY中国设计秀
                fs = new FileStream(strFilePath, FileMode.Open, Fileaccess.Write);RYY中国设计秀
                WriteFilePath(fs);RYY中国设计秀
            }RYY中国设计秀
            elseRYY中国设计秀
            {RYY中国设计秀
                fs = new FileStream(strFilePath, FileMode.Create, FileAccess.Write);RYY中国设计秀
                WriteFilePath(fs);RYY中国设计秀
            }RYY中国设计秀
        }RYY中国设计秀
    }RYY中国设计秀
RYY中国设计秀
}RYY中国设计秀

本文引用地址:/bc/article_46191.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明