How to find a path to a folder in the Assets folder?

How do I find the path to ‘MyFolder’ somewhere deep within the Assets folder? I’ve searched the Directory and AssetDatabase docs but can’t find a way.

The closest is Directory.GetFiles(path), but that only lists the files within one given path.

Thanks

You want to use Directory.GetDirectories() or Directory.GetFiles()

You can create a recursive function if necessary to get to the deepest subdirectory level if necessary.

You can also use string substitution with string.Replace() to convert those paths into asset paths relative to the Assets directory.

I hope this helps!