read a textfile line by line and search into folder that filename exist into folder or not ?
i am putting filename into one textfile my program read this file and display filenames ...
want to implement when one line is read from textfile seach that name of file is exist into folder or not ...
Here is my code
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- namespace ReadFIles
- {
- class Program
- {
- static void Main(string[] args)
- {
- int counter = 0;
- string 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 in a Filename.txt .", counter);
-
- System.Console.ReadLine();
- }
- }
- }