- /// <summary>
- /// 根据文件夹路径得到文件路径下所有的文件
- /// </summary>
- /// <param name="pathtext"></param>
- //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)
- // {
- // FileInfo f = new FileInfo(file);
- // //得到文件的创建时间
- // DataRow dr1 = Photo_LibraryTable.NewRow();
- // //Photo_ID Photo_Path Photo_Name State Star_LibraryID
- // dr1["Photo_ID"] = "0";//ID编号
- // dr1["Photo_Path"] = "/Star/"+modelStar_Library.Pinyin+"/";//存储的地址
- // dr1["Photo_Name"] = f.Name;//文件名称
- // dr1["State"] = "1";//表示已审核
- // dr1["Star_LibraryID"] = modelStar_Library.Stage_Name;//明星艺名
- // foreach(DataRow dr in Photo_Libraryds.Rows)
- // {
- // DateTime CreationTime = File.GetCreationTime(file);//文件创建时间
- // // string strfilename = file.Substring(file.LastIndexOf("//") + 1);//取得文件名
- // //string strfileend = file.Substring(file.LastIndexOf(".") + 1);//取得文件类型
- // //得到文件的大小
- // string strFile = dr["Photo_Name"].ToString();//得到数据库存储的没有进行审核的相片名称
- // if (strFile==f.Name) //如果名称相同 则设置成没有审核
- // {
- // dr1["State"] = "0";//表示未审核
- // }
- // // long len = f.Length;//单个文件大小
- // // j = j + len;//总文件大小
- // // a++;//文件个数
- // }
- // Photo_LibraryTable.Rows.Add(dr1);
- // //Response.Write(f.Name);
- // //得到符合条件的文件,某个时间段之前的文件
- // //file文件地址
- // // Response.Write(file+"file<br/>");
- // //Response.Write(len.ToString()+"文件大小<br/>");
- // }
- // this.gvPhoto_LibraryList.DataSource = Photo_LibraryTable;
- // this.gvPhoto_LibraryList.DataBind();
- // //关闭窗口
- // //Response.Write (a.ToString()+"文件个数<br/>");//输出个数
- // // int i = a;
- // //Response.Write(j.ToString());
- // // long x = j /1024;
- // //Response.Write(x.ToString() + "KB 文件大小<br/>");//得到大小
- // //Response.Write("搜索完毕!系统提示<br/>");
- // }
- // }
- // catch
- // {
- // // Response.Write("请检查路径是否正确");
- // Common.MsgBox2("文件路径读取错误!", "StarManage.aspx");
- // }
- //}