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 8094325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:45:55+00:00 2026-06-05T20:45:55+00:00

I have a directory with multiple sub directories that contain .doc files. Example: C:\Users\tmedina\Documents\testenviroment\Released\500\test0.doc

  • 0

I have a directory with multiple sub directories that contain .doc files. Example:

C:\Users\tmedina\Documents\testenviroment\Released\500\test0.doc
C:\Users\tmedina\Documents\testenviroment\Released\501\test1.doc
C:\Users\tmedina\Documents\testenviroment\Released\502\test2.doc
...
C:\Users\tmedina\Documents\testenviroment\Released\520\test20.doc

In my code below, I am trying to display in a list box all of the files that end with extension ‘.doc’ that are in sub directories of C:\Users\tmedina\Documents\testenviroment\Released

So for example, I have

Dim root As String = "C:\Users\tmedina\Documents\testenviroment"

For Each fileFound As String In Directory.GetFiles(Path.Combine(root, "Released\*\*.doc"))
        ListBox1.Items.Add(fileFound)
    Next

But it keeps throwing out Illegal characters in path error.
Any suggestions on what I’m doing wrong?

  • 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-05T20:45:57+00:00Added an answer on June 5, 2026 at 8:45 pm

    The filesystem doesn’t understand the double * in released\*\*.doc
    Directory.GetFiles oveload that takes only one argument doesn’t like the partial path specification (….*.doc)

    Try with this

    Dim root As String = "C:\Users\tmedina\Documents\testenviroment\released" 
    
    For Each fileFound As String In Directory.GetFiles(root, "*.doc", SearchOption.AllDirectories)) 
        ListBox1.Items.Add(fileFound) 
    Next 
    

    The Visual Basic language doesn’t need to escape the \ character.
    The Directory.GetFiles has an overload that takes your base path, a wildcard search string, and an option to search all of the subfolders of the base path.

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

Sidebar

Related Questions

I have a directory which contains multiple sub-directories with mov and jpg files. /dir/
I am going to have one directory with multiple sub-directories. I want to be
I have a highly structured hierarchical directory containing multiple files that need to be
I have directory that contain multiple file i need to load on specified file.
I have multiple files in a directory, example: linux_file1.mp4 , linux_file2.mp4 and so on.
I have a .zip file that contains sub-directories with html,png, and css files in
I'm trying to achieve the following: I have a directory with multiple video files
The Issue: when multiple users have access to the same working directory, permissions issues
I have multiple hidden files in a directory and would like to open and/or
I have a Java application that parses pdf files in a directory and its

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.