Akshay

Akshay

  • NA
  • 82
  • 46.9k

problem in log maintain (store only 1st file name)

Nov 20 2014 12:46 AM
in my physical folder i retrieve all fill name and now store it in myfile.txt 
my problem is if in my folder i have 2 files so it store 1st file namein myfile.txt
than 2nd time it read 2nd file name and again open myfile.txt and write file name on 1st line,
that time 1st file name override with 2nd file name
here is my code=>
string subPath = row["DocPathOnDIsk"].ToString();
string physicalPath = @"D:\New folder\documents to be uploaded\"; 
 string fullpath = Path.Combine(physicalPath, subPath);
 string[] fileNames = Directory.GetFiles(fullpath);
foreach (var s in fileNames)
{


File.WriteAllText("myfile.txt", s);
Console.WriteLine(s);
Console.ReadLine();
}








in above code File.WriteAllText  (it open file and overide all times)
so is there in any other method for maintain multiple file name in single file without override .........