How to get all the subfolders and files names in a given folder?

  1. Any built-in or 3rd party component can do this?
  2. How to pick a file name randomly under a folder when the files name are irregular?

There probably is an existing plugin that I’m not aware of, I went for C# using :

GetFilesAndSubfolders.gh (4.2 KB)

If you only need the file name and not the complete path : use Text Split by " \ ", Reverse List, List Item.

1 Like

You can do this in Python:

import os

a = os.listdir(folder)

2 Likes