Results 1 to 5 of 5

Thread: [RESOLVED] Querying a list of FileInfo for a filename

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Resolved [RESOLVED] Querying a list of FileInfo for a filename

    I am using the code below to get a list of files from multiple folder paths. Now I want to query that list to see if a specified file name exists. I don't want to loop through the list one file at a time, but rather use something like LINQ, but I'm not sure how to do it. I'm hoping someone can help me out. Thanks...


    Code:
            Dim allFiles As New List(Of IO.FileInfo)
            Dim files As IO.FileInfo()
    
            files = New IO.DirectoryInfo(folderPath1).GetFiles("*")
            allFiles.AddRange(files)
    
            files = New IO.DirectoryInfo(folderPath2).GetFiles("*")
            allFiles.AddRange(files)
    
            files = New IO.DirectoryInfo(folderPath3).GetFiles("*", IO.SearchOption.AllDirectories)
            allFiles.AddRange(files)
    Last edited by nbrege; May 1st, 2023 at 12:23 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width