如何将文件名复制到新的文本文件中 [英] How to copy the filename into a new text file

查看:93
本文介绍了如何将文件名复制到新的文本文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的代码中,我想在循环中复制每个文件的文件名
到新的文本文件..

In the below code I want to copy the file name of each file in the loop
to a new text file..

foreach (FileInfo FI in FileList)
         {
             Console.WriteLine(FI.FullName);
             Console.WriteLine(FI.LastWriteTime.ToShortDateString());
             string dt = FI.LastWriteTime.ToShortDateString();
             if(DateTime.Now.ToShortDateString()== dt)
             {
                 readfile(FI);
             }
             Console.WriteLine(dt);
         }



请帮忙:)

[Edit]取消选中忽略文本中的HTML" [/Edit]



Please help :)

Unchecked "Ignore HTML in text"[/Edit]

推荐答案

此MSDN示例向您展示如何写入文本文件:

http://msdn.microsoft.com/en-us/library/6ka1wd3w.aspx [ ^ ]

因此,您无需将结果回显到控制台,而是写入文件.
This MSDN example shows you how to write to a text file:

http://msdn.microsoft.com/en-us/library/6ka1wd3w.aspx[^]

So instead of echoing the results to the console, you write to the file.


这篇关于如何将文件名复制到新的文本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆