TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yogesh Vedpathak
670
1.4k
197.7k
read a textfile line by line and search into folder
Jul 10 2018 4:29 AM
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 ;
// 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++;
// string Userinput = line;
//string filePresentCK = file2 + Userinput;
//if (File.Exists(filePresentCK))
//{
// Console.Write("File Found");
//}
//else
//{
// Console.Write("File Not Found");
//}
//if (!Directory.Exists(@"C:\FtpBackup\" + line))
//{
// Console.WriteLine("File Exist");
//}
}
file.Close();
System.Console.WriteLine(
"There were {0} lines in a Filename.txt ."
, counter);
// Suspend the screen.
System.Console.ReadLine();
}
}
}
Reply
Answers (
5
)
Xamarin Forms Error Package
MultipleSelect Dropdown list clear