# GetSubFolders(string)

> Obtains the subdirectories of a given directory in the Assets folder.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static string[] GetSubFolders(string path)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The path of a directory in the Assets folder relative to the project folder root.

### Returns

| Type                                                               | Description                                      |
| ------------------------------------------------------------------ | ------------------------------------------------ |
| [string\[\]](https://learn.microsoft.com/dotnet/api/system.string) | Returns an array of the folder's subdirectories. |

### Examples

```csharp
using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour
{
    [MenuItem("AssetDatabase/Get Folder List")]
    static void SubFolderExample()
    {
        //This method prints out the entire folder list of a project into the console
        var folders = AssetDatabase.GetSubFolders("Assets");
        foreach (var folder in folders)
        {
            Recursive(folder);
        }
    }

    static void Recursive(string folder)
    {
        Debug.Log(folder);
        var folders = AssetDatabase.GetSubFolders(folder);
        foreach (var fld in folders)
        {
            Recursive(fld);
        }
    }
}
```
