今天要写一个功能的代码,读.log文件并去相关字段写入.txt 。在此做个笔记!
public const string ReadFilePath = "C:\\Documents and Settings\\admin\\桌面access_20111207.log";
public const string WriteFilePath = "C:\\Documents and Settings\\admin\\桌面\\log.txt";
public static ArrayList al;
static void Main(string[] args)
{
ReadPath("C:\\Documents and Settings\\admin\\桌面");
//单个文件
//if (File.Exists(ReadFilePath))
//{
// ReadLog(ReadFilePath);
//}
//else
//{
// Console.WriteLine("读入的文件不存在!");
// Console.ReadLine();
//}
}
public static void ReadPath(string path)
{
if (System.IO.Directory.Exists(path))
{
DirectoryInfo d