Get list of files in folder / Put their names in a list

Hey guys,

Is there a way to get the name of each and every .txt file in a specific folder and then put their names (with or without the .txt bit) into a list? This list then will be displayed on my loading screen.

The files all share the first two letters “gs” and then numbers, determining what time the file was created/what area name player saved in. They are all .txt files.

Would this even be possible?

Thank you for all info on this

Pete

This topic should help: http://stackoverflow.com/questions/3207219/how-to-list-all-files-of-a-directory-in-python

Also I believe you can use bge.logic.expandPath if you are trying to use a relative path.

Indeed, I have the expandPath in there.

I’m looking through the posts on that page, seems like it’s exactly what I need! I shall get working then :slight_smile:

Thank you!