How to search for a number directory names using GetDirectories C#
<p>I am writing a code to get the sub directories from the output folder  with names "1", "2", "3", "4" etc. (i.e. sub directory with only number names)</p>

<p>For example:
This is my output folder:C:\Users\xyz\Desktop\Output</p>

<p>I want to get sub directories with names </p>

<blockquote>
  <p>"1", "2", "3", "4"</p>
</blockquote>

<p>Output: </p>

<blockquote>
  <p>C:\Users\xyz\Desktop\Output\A\A1\1<br>
  C:\Users\xyz\Desktop\Output\A\A1\2<br>
  C:\Users\xyz\Desktop\Output\A\A1\3<br>
  C:\Users\xyz\Desktop\Output\A\A1\4<br>
  C:\Users\xyz\Desktop\Output\A\A2\1<br>
  C:\Users\xyz\Desktop\Output\A\A2\2</p>
</blockquote>

<p>In my code I tried to use the search pattern but was not able to find the desired output:</p>

<p>Here is the snippet, which gets all the sub directories with name "1"</p>

<pre><code>string[] destDir1 = Directory.GetDirectories(
    destinationFolderPath, 
    "1",
    SearchOption.AllDirectories);
</code></pre>

<p>So in order to get all the directories with names "1", "2", "3" and "4" I used the square bracket wild card as below and this does not work. </p>

<pre><code>string[] destDir1 = Directory.GetDirectories(
    destinationFolderPath, 
    "[0-9]", 
    SearchOption.AllDirectories);
</code></pre>

<p>I followed the <a href="https://msdn.microsoft.com/en-us/library/afy96z92(v=vs.90).aspx" rel="nofollow">msdn link</a> to get more options for search pattern wildcards</p>

<p>What is wrong in this logic?</p>