Advertisement
In this article i am going to explain how to get image names inside a folder and move names to text file in c#.
I am having 2000 images(.jpg) in image folder and want to get all the image names, that stores in one text file. The following code will help you to get all image names which stores in one text file.
string[] array1 = Directory.GetFiles(@"C:\Images\", "*.jpg");
Console.WriteLine(array1.Count().ToString());
int count = 1;
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Imgs.txt"))
{
foreach (string name in array1)
{
string[] spltname = name.Split('\\');
Console.WriteLine(spltname[spltname.Length-1]);
file.WriteLine(count.ToString()+","+spltname[spltname.Length - 1]);
count++;
}
}
I am having 2000 images(.jpg) in image folder and want to get all the image names, that stores in one text file. The following code will help you to get all image names which stores in one text file.
string[] array1 = Directory.GetFiles(@"C:\Images\", "*.jpg");
Console.WriteLine(array1.Count().ToString());
int count = 1;
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Imgs.txt"))
{
foreach (string name in array1)
{
string[] spltname = name.Split('\\');
Console.WriteLine(spltname[spltname.Length-1]);
file.WriteLine(count.ToString()+","+spltname[spltname.Length - 1]);
count++;
}
}
8CBA5C9351
ReplyDeletekiralık hacker
hacker bulma
tütün dünyası
-
-
DFAB668096
ReplyDeleteTakipçi Satın Al
M3u Listesi
MMORPG Oyunlar
Lords Mobile Promosyon Kodu
Whiteout Survival Hediye Kodu