Showing posts with label Directory collection. Show all posts
Showing posts with label Directory collection. Show all posts

Thursday, September 24, 2009

Listing server files

This code snippet for listing all the files under specific folder.
string[] list = Directory.GetFiles(Server.MapPath("~/Images"));
for (int i = 0; i < files.Length; i++){
list [i] = Path.GetFileName(list [i]);
GridView1.DataSource = list;
GridView1.DataBind(); }