日期:2014-05-18 浏览次数:21182 次
[WebMethod] public string GetFileList(string sPath) { string BaseUriStr = Server.MapPath("./") + sPath; string sRest = string.Empty; if (Directory.Exists(BaseUriStr) == true) { List<string> list = new List<string>(); //获取当前目录下指定文件类型的文件列表 string[] stringList = Directory.GetFiles(BaseUriStr, "*.*", SearchOption.TopDirectoryOnly); foreach (string str in stringList) { string fileName; fileName = System.IO.Path.GetFileName(str); list.Add(fileName); } foreach (string s in list) { sRest += s + "|"; } sRest = sRest.TrimEnd('|'); return sRest; } else { return null; } }
------解决方案--------------------
参考:http://wucountry.cnblogs.com/archive/2006/02/15/331248.aspx
------解决方案--------------------
帮顶,学习个
------解决方案--------------------
学习一下