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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:22:32+00:00 2026-06-03T07:22:32+00:00

Please read the entire post as the entire post is relevant. I wrote this

  • 0

Please read the entire post as the entire post is relevant.

I wrote this C# code:

static void DumpDir(string dir)
{
    string[] subdirs = Directory.GetDirectories(dir);
    foreach (string subdir in subdirs)
    {
        DumpDir(subdir);
    }

    string[] files = Directory.GetFiles(dir);

}

static void Main(string[] args)
{
    string startdir = @"G:\multimedia_dump";
    dirindexstart = startdir.Split('\\').Length;
    string[] dirs = Directory.GetDirectories(startdir);

    foreach (string dir in dirs)
    {
        DumpDir(dir);
    }
}

It opens a hard-coded directory, and loops through all of its subdirectories recursively. That’s all it does. That’s it.

However, it errors on a particular folder:

The Error

Notice how this is not the initial directory. Notice how, if you follow the code, it must logically be derived from one of the Directory.GetDirectories() calls. This folder name was not poorly generated. It’s real.

Not only is it real, but I can navigate to it in Explorer’s GUI:

GUI Lets Me Navigate There

Oddly enough, if you navigate to the folder in CMD, it’ll show up in DIR, but if you TAB until you get a suggestion for the folder name, it will not let you CD into it. I’d post a third link, but this thing won’t let me because I’m new.

What gives? I think the software that generated this folder did so using a low-level NTFS call of some kind. Is there a way to programatically sanitize these folder names, or work around this error so you can access folders that exist but shouldn’t?

  • 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-03T07:22:33+00:00Added an answer on June 3, 2026 at 7:22 am

    It looks like your path contains a |. This is an illegal character, as far as the normal Win32 APIs are concerned, but not as far as the NT APIs are concerned.

    You can disable some Win32 path limitations(for example the maximal path length of ~260 chars) by prefixing the path with \\?\, but it looks like this doesn’t include |.

    So you probably need to drop down to the NT APIs to deal with this.

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

Sidebar

Related Questions

Please read this entire question before you try to mark this as too controversial.
Since this is a huge post here is a short summary (please read the
Please read the entire question. I have a unique situation with several constraints that
I was trying to implement a tableview like this one please read the comment
I wasn't sure what to put into the title for this...please read on... I
Here is what I got so far. Please read the comment in the code.
This is my homework, but please read my problem description first. I have to
There are some other variations of this question here at SO, but please read
I'm now blocked by this problem the entire day, read thousands of google results,
Please read this first. How do I make a button invisible just after click?

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.