-
-
-
-
- public void ListFiles(string pathtext)
- {
- try
- {
-
- if (pathtext == null ||pathtext.Equals(""))
- {
- Response.Write("路径不能为空错误");
- }
- else
- {
-
- string[] filename = Directory.GetFiles(Server.MapPath(pathtext));
-
- int a = 0;
-
- long j = 0;
-
- foreach (string file in filename)
- {
-
- DateTime CreationTime = File.GetCreationTime(file);
-
-
- Response.Write(file+"file<br/>");
-
- FileInfo f = new FileInfo(file);
- long len = f.Length;
- Response.Write(len.ToString()+"文件大小<br/>");
- j = j + len;
- a++;
- }
-
- Response.Write (a.ToString()+"文件个数<br/>");
- int i = a;
-
- long x = j /1024;
- Response.Write(x.ToString() + "KB 文件大小<br/>");
- Response.Write("搜索完毕!系统提示<br/>");
- }
- }
- catch
- {
- Response.Write("请检查路径是否正确");
- }
- }
posted on
2008-11-12 12:54
叮叮猫的编程世界
阅读(
388)
评论()
编辑
收藏
举报