string[] FilesToRead = { @"C:\mycode\datafiles\foo.txt" };
int FileCount = FilesToRead.Length;
for (int fPtr = 0; fPtr < FileCount; fPtr++)
{
string nextFile = FilesToRead[fPtr];
bool b = File.Exists(nextFile);
string[] lines = System.IO.File.ReadAllLines((nextFile);
}
// The name of the file.
const string fileName = { @"C:\mycode\datafiles\foo.txt" };
// Create new FileInfo object and get the Length.
FileInfo f = new FileInfo(fileName);
long s1 = f.Length;
for (int fPtr = 0; fPtr < FileCount; fPtr++)
{
string nextFile = FilesToRead[fPtr];
bool b = File.Exists(nextFile);
if (b == True)
{
string[] lines = System.IO.File.ReadAllLines((nextFile);
}
}
?System.IO.Directory.GetFiles(@"C:\mycode\datafiles")
Open in new window