Filling a Grid with Files in a Folder - C#
This code sample shows, in C#, how to get all the files within a specific folder, and list them all, including the file size, in a Gridview control.
To access the FileSystem, you’ll need to import the System.IO namespace, and to use a DataTable, you must import the System.Data namespace:
using System.IO;
using System.Data;