On first point, Use file fullName instead of file object like:
lines = File.ReadAllLines(file.FullName);
On second point, initialize csvfile outside the foreach loop because this object initialized every time and you are not getting merged result. Full code is below:
string folderPath = @"C:/Temp/";
string destfile = @"C:/CSVFOLDER/sample.csv";
StreamWriter csvfile;
string[] lines, cells;
DirectoryInfo dir = new DirectoryInfo(folderPath);
FileInfo[] files = dir.GetFiles("unit*", SearchOption.TopDirectoryOnly);
csvfile = new StreamWriter(destfile);
foreach (var file in files)
{
lines = File.ReadAllLines(file.FullName);
for (int x = 0; x < lines.Length; x++)
{
cells = lines[x].Split(new Char[] { '\t', ';' });
for (int j = 0; j < cells.Length; j++)
csvfile.Write(cells[j] + "\t");
csvfile.WriteLine();
}
}
csvfile.Close();