windows c Sharp
In my project one folder name Root in
Root contains .txt files
eg: text.txt, text1.txt, text2.txt
how i can get list of all files and i am created new file using coding
how i name it automatically for file name text3.text
and how i read last created file in this directory
Loading
Hirendra SisodiyaPosted Apr 14, 2010, 6:13 AM
you can find list of all textfile by this code:
string Filenames="";
DirectoryInfo Dir=new DirectoryInfo("C:\\trash");
FileInfo[] files = Dir.GetFiles("*.txt");
foreach (FileInfo tempfile in files)
{
Filenames = Filenames + " , " + tempfile.Name.ToString();
DateTime dt = tempfile.CreationTime;
}
you can also find created time of each file so you can find latest created time....
thanks
Please mark as answere if it helps