Access many files from a directory in p5

Is there a way of accessing many files without hard-coding their names manually (or having their names be “1.txt”,“2.txt”,“3.txt”,“4.txt”…)? In processing you would use file.list(), but as far as I know this doesn’t exist in p5?

I found a fix: I made processing sketch that uses file.list() to put all the string names of the files into a text file, which can be accessed from p5, which then can use these strings to access the files.