Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:44:20+00:00 2026-06-11T07:44:20+00:00

my problem is that i’m reading a directory then i filter the files by

  • 0

my problem is that i’m reading a directory then i filter the files by name, but also in this directory there are other files with different names, what i am trying to do is enter this file with different name and read line number 6, and if this line matches with the name of the other files that have same name, save this files into and array to process them later.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:44:22+00:00Added an answer on June 11, 2026 at 7:44 am

    Try this:

    String dir = @"C:\Temp";
    String pattern = "*.txt";
    var foundFiles = new List<String>();
    
    foreach (String filePath in Directory.EnumerateFiles(dir, pattern))
    {
        foreach (String filePath2 in Directory.EnumerateFiles(dir, pattern))
        {
             if (filePath != filePath2 &&
                 File.ReadLines(filePath2).ElementAtOrDefault(5) == Path.GetFileName(filePath))
                 foundFiles.Add(filePath);
        }
    }
    

    Note: totally untested and written without IDE, but maybe it’s helpful anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
The problem that I have is this: I have a lot of XSD files
Seems to be a problem that many people have, but all the answers I
This is a problem that is quite the opposite of the regular use of
XML problem that's got me stumped, but is probably very simple... The XML is
This is a design problem that I am trying to figure out. I will
I have a problem that i've struggled with for a long time. This problem
the problem that im having is this that i am able to create a
I have this problem that my .php file is presented as clear text in
I have this big problem that i dont know how to fix. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.