可以显示文件的路径,大小,创建日期,最后修改日期,最后访问日期'''
自己弄了一个星期也没弄出来,高手来帮忙研究下。

解决方案 »

  1.   

    FileInfo类 
    System.IO.FileInfo; 名称  说明  
       Attributes   获取或设置当前 FileSystemInfo 的 FileAttributes。(从 FileSystemInfo 继承。) 
       CreationTime   获取或设置当前 FileSystemInfo 对象的创建时间。(从 FileSystemInfo 继承。) 
      CreationTimeUtc   获取或设置当前 FileSystemInfo 对象的创建时间,其格式为协调通用时间 (UTC)。(从 FileSystemInfo 继承。) 
       Directory  获取父目录的实例。 
       DirectoryName  获取表示目录的完整路径的字符串。 
       Exists  已重写。获取指示文件是否存在的值。 
       Extension   获取表示文件扩展名部分的字符串。(从 FileSystemInfo 继承。) 
       FullName   获取目录或文件的完整目录。(从 FileSystemInfo 继承。) 
      IsReadOnly  获取或设置确定当前文件是否为只读的值。 
       LastAccessTime   获取或设置上次访问当前文件或目录的时间。(从 FileSystemInfo 继承。) 
      LastAccessTimeUtc   获取或设置上次访问当前文件或目录的时间,其格式为协调通用时间 (UTC)。(从 FileSystemInfo 继承。) 
       LastWriteTime   获取或设置上次写入当前文件或目录的时间。(从 FileSystemInfo 继承。) 
      LastWriteTimeUtc   获取或设置上次写入当前文件或目录的时间,其格式为协调通用时间 (UTC)。(从 FileSystemInfo 继承。) 
       Length  获取当前文件的大小。 
       Name  已重写。获取文件名。 
      

  2.   

    using System;
    using System.IO;namespace touch
    {
        class Touch
        {
            static void Main(string[] args)
            {
                // Make sure a filename was provided.
                if (args.Length > 0)
                {
                    // Verify that the provided filename exists.
                    if (File.Exists(args[0]))
                    {
                        FileInfo fi = new FileInfo(args[0]);
                        touchFile(fi);
                    }
                    else
                    {
                        Console.WriteLine(
                            "Could not find the file: {0}.", args[0]);
                    }
                }
                else
                {
                    Console.WriteLine("No file was specified.");
                }
            }        static void touchFile(FileSystemInfo fsi)
            {
                Console.WriteLine("Touching: {0}", fsi.FullName);            // Update the CreationTime, LastWriteTime and LastAccessTime.
                try
                {
                    fsi.CreationTime = fsi.LastWriteTime = fsi.LastAccessTime =
                        DateTime.Now;
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error: {0}", e.Message);
                }
            }
        }
    }
      

  3.   

    using System;
    using System.IO;class Test 
    {    
        public static void Main() 
        {
            string path = @"c:\temp\MyTest.txt";
            FileInfo fi1 = new FileInfo(path);        try 
            {  
               //文件的路径
                string filePath=fi1.DirectoryName
                //文件的创建日期
               DateTime d1=fi1.CreationTime
               //文件的最后访问日期
               DateTime d2=fi1.LastAccessTime 
               //文件的最后修改日期
               DateTime d3=fi1.LastWriteTime
               //文件的大小(Bytes)
               long legth=fi1.Length
            } 
            catch (Exception e) 
            {
                Console.WriteLine("The process failed: {0}", e.ToString());
            }
        }
    }
      

  4.   

    恩 谢谢楼上几位 我是用在WEB里的 是个网页 文件夹里的文件被我用TREEVIEW列在了页面上 现在想实现点左边的节点 就能在右边的GRIDVIEW里显示出来 
      

  5.   

    要用Response.Write这类型的编写 不是Console.WriteLine的 麻烦高人指点