what you are trying to do can be achieved using the following code:
func get_10_files(dir: String) -> Array:
var d := Directory.new()
var files := 
for i in 10:
var file_name := d.get_next()
if lap_time == "":
break # there was less than 10 files
However this is a really weird way of doing things.
Array have a
sort method that sort their content.
A better method would be to store al scores in a single file and work from here rather than relying on your OS sorting file names...