Godot Tutorial: How to read all files in EVERY sub directory (Breadth/Depth first Search)

Опубликовано: 14 Март 2026
на канале: Kyle Luce
1,799
34

Godot Tutorial: How to read all files in EVERY sub directory (Breadth/Depth first Search)

Hey all,

So I was thinking of writing some automated smoke tests in Godot for a project I'm working on and I realized, I don't think I've ever done directory I/O in Godot.

The tools is so well integrated that I've never really had to mess with it yet.
I'm willing to bet many of you guys haven't either.
Don't worry it's easy, lets get into it.


You'll learn:

How to read all files in a directory to process however you'd like
How to use Depth First Search
How to use Breadth First Search
The order that both search styles will traverse a tree


Code From Tutorial:

How to use:
Create a "Node" type of Godot Node
Note in Video I used Node2D which is OK, but slighly better to use plain Node since no 2D coords etc are needed
Attach this script to that Node:

https://gist.github.com/Razzlegames/2...


Tools:
Godot 3.1.1

My current Hardware setup: https://timecubepuzzle.blogspot.com/p...