Yogesh Vedpathak

Yogesh Vedpathak

  • 669
  • 1.4k
  • 197.7k

i wan to search file exist or not using textline ...

Jul 9 2018 7:05 AM
when program readtextfile line by line i want do search file into another folder whether file exist or not ...using textline  
 
 
using System.Linq;
using System.Text;
namespace ReadFIles
{
class Program
{
static void Main(string[] args)
{
int counter = 0;
string line;
// Read the file and display it line by line.
System.IO.StreamReader file =
new System.IO.StreamReader(@"C:\FtpBackup\Yogesh.txt");
string file2 = @"C:\FtpBackup\Ndata";
while ((line = file.ReadLine()) != null)
{
System.Console.WriteLine(line);
counter++;
}
file.Close();
System.Console.WriteLine("There were {0} lines.", counter);
// Suspend the screen.
System.Console.ReadLine();
}
}
}

Answers (7)