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

  • Home
  • SEARCH
  • 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 8045263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:29:34+00:00 2026-06-05T05:29:34+00:00

I have a List of string that contains files in which should be ignored

  • 0

I have a List of string that contains files in which should be ignored for manipulating purposes. So I’m curious of how to handle the situation that has a wild card in it.

For example, the possible inputs in my List of String are:

C:\Windows\System32\bootres.dll
C:\Windows\System32\*.dll

The first example I think is easy to handle, I can just do a string equals check (ignoring case) to see if a file matches. However I am not sure how to determine if the given file may match the wild card expression in the list.

A little background into what I am doing. A user is allowed to copy a file to/from a location, however, if the file matches any file in my List of String I don’t want to allow the copy.

There might be a must better approach to handling this.

The files I want to exclude are read in from a configuration file, and I receive the string value of the path that is attempting to be copied. Seems like I have all of the information I need to complete the task, it’s just a matter of what is the best approach.

  • 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-05T05:29:35+00:00Added an answer on June 5, 2026 at 5:29 am
    IEnumerable<string> userFiles = Directory.EnumerateFiles(path, userFilter);
    
    // a combination of any files from any source, e.g.:
    IEnumerable<string> yourFiles = Directory.EnumerateFiles(path, yourFilter);
    // or new string[] { path1, path2, etc. };
    
    IEnumerable<string> result = userFiles.Except(yourFiles);
    

    To parse a semicolon-delimited string:

    string input = @"c:\path1\*.dll;d:\path2\file.ext";
    
    var result = input.Split(";")
                      //.Select(path => path.Trim())
                      .Select(path => new
                      {
                          Path = Path.GetFullPath(path), //  c:\path1
                          Filter = Path.GetFileName(path) // *.dll
                      })
                      .SelectMany(x => Directory.EnumerateFiles(x.Path, x.Filter));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string ($c) that contains a comma-separated list of settings. Some settings
I have a string list (TStrings) that has a couple thousand items in it.
I have a list that has some chapter numbers in string. When I sort
I have a web service that contains this method: [WebMethod] public static List<string> GetFileListOnWebServer()
I have a list of string that I am writing out to a CSV
I have a List of String objects that are pipe delimited. something like this:
I have a list of string values that I want add to a hashtable
I have a content string that starts with an unordered list I want to
I have a method that returns a list of type string. I want to
I have a TStringList which is sorted and contains unique filenames. The list can

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.