static void GetAllFiles()
{
string path = "filepath";
var allFiles = Directory.GetFiles(path);
string fileName = "file.txt"; using (FileStream fStream = File.Create(fileName))
{ } using (FileStream fStream = File.Create("file.txt"))
{
using (StreamWriter writer = new StreamWriter(fStream, Encoding.UTF8))
{
foreach (var file in allFiles)
{
writer.WriteLine(file);
}
}
}
}

C# get files and write the files full name in txt的更多相关文章

  1. Advanced Installer读取注册表时将Program Files读取为Program Files (x86)的解决办法

    原文:Advanced Installer读取注册表时将Program Files读取为Program Files (x86)的解决办法 今天同事在做安装包的时候,有一个读取注册表路径的需求,需要根据 ...

  2. [TypeScript] Configuring TypeScript Which Files to Compile with "Files" and "OutDir"

    This lesson shows how to configure the .tsconfig so you only compile the .ts files you want. It then ...

  3. high-level operations on files and collections of files

    11.10. shutil — High-level file operations — Python 3.6.5 documentation https://docs.python.org/3/li ...

  4. How do I list the files in a directory?

    原文地址:How do I list the files in a directory? You want a list of all the files, or all the files matc ...

  5. linux文件描述符open file descriptors与open files的区别

    一个文件被打开,也可能没有文件描述符,比如current working diretories,memory mapped files and executable text files ;losf可 ...

  6. How to configure Veritas NetBackup (tm) to write Unified and Legacy log files to a different directory

    Problem DOCUMENTATION: How to configure Veritas NetBackup (tm) to write Unified and Legacy log files ...

  7. Embed dll Files Within an exe (C# WinForms)—Winform 集成零散dll进exe的方法

    A while back I was working on a small C# WinForms application in Visual Studio 2008. For the sake of ...

  8. TN035: Using Multiple Resource Files and Header Files with Visual C++

    TN035: Using Multiple Resource Files and Header Files with Visual C++ This note describes how the Vi ...

  9. Untracked files不想add

    $ git status On branch feature/20160420_complain_630222 Untracked files: (use "git add <file ...

随机推荐

  1. IDE开发小技巧-快速引包/替换关键词

    快速引包 Ctrl+Shift+O 快速搜索/查找替换   Ctrl+F

  2. RTX5的汽车级,工业级,医疗和铁路安全认证已经通过,证书已颁发

    说明: 1.当前RTX5的教程已经在制作中,使用CMSIS-RTOS V2封装层,含FreeRTOS,配套V7,V6和V5板子​. 2.我们各种开发板和模块的资料汇总贴,搞了个cnblogs,临时先用 ...

  3. IT兄弟连 HTML5教程 HTML5文字版面和编辑标签 小结及试题

    小结 HTML标签包含结构标签和基础标签,基础标签是在页面制作最常使用的一些标签.基础标签包含标题标签(<h1>~<h6>).换行标签(<br>).段落标签(< ...

  4. Linux中,Tomcat 怎么承载高并发(深入Tcp参数 backlog)

    一.前言 这两天看tomcat,查阅 tomcat 怎么承载高并发时,看到了backlog参数.我们知道,服务器端一般使用mq来减轻高并发下的洪峰冲击,将暂时不能处理的请求放入队列,后续再慢慢处理.其 ...

  5. CPU异常分析(以trap00为例)

    Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html CPU异常的记录(trap00为例) 一.CPU检测到除零异常的执 ...

  6. Scrapy中response属性以及内容提取

    一.属性 url :HTTP响应的url地址,str类型 status:HTTP响应的状态码, int类型 headers :HTTP响应的头部, 类字典类型, 可以调用get或者getlist方法对 ...

  7. js基础——错误处理

    一:错误捕获 1.try-catch 语句(错误捕获) try{ //这里放置可能出现问题的代码 }catch(error){ //错误发生时执行的代码 console.log(error.name) ...

  8. [转]Blue Prism Opening a password protected Excel workbook?

    本文转自:https://www.rpaforum.net/threads/opening-a-password-protected-excel-workbook.470/ 问: As the tit ...

  9. ubuntu 或centos 使用Docker搭建anaconda+python基本环境

    ubuntu 16 使用Docker安装anacondaubuntu docker 安装centos docker 安装搜索可用镜像 docker search anaconda 拉取你中意的镜像 d ...

  10. USB HOST与 USB OTG的区别及工作原理

    在SmartQ 7上面,同时存在USB HOST与 USB OTG两个接口,我想问一下,这两个接口有什么区别么?我怎么认为HOST属于是多余呢? 麻烦高手解答,感激不尽!!! 转自USB HOST与 ...