How to read all files from specific folder using C# Code
Step 1: Create your website first in asp.net and create one default.aspx page.
Step 2: Open file source code .cs file or .vb file and paste below code in that file
//add System.IO package
using System.IO
// specify the path of images
string imageFolderLocation= @"c:\imageFolder\";
// get all files from the specify location by using Directory inbuilt library.
string[] Imagefiles = Directory.GetFiles(imageFolderLocation);
//print the all file location to your page using response.write command
for (int i = 0; i < Imagefiles .Length; i++){
Response.Write(Imagefiles [i]);
}
Step 3 : This way you can access all files from specific folder and you can do any of the transaction like move,delete..etc
No comments:
Post a Comment
Thank you for your interest .