Use PltScheme's standard function directory-list to retrieve the contents in a directory and do something with them.

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

You just have to take in account that directory-listreturns a list of all files and directories in the directory specified by path. If path is omitted, a list of files and directories in the current directory is returned.

If you need to process the files only. We can define a new procedure that only retrieves the files in a directory like this:

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

So our first code will turn into

500 Can't connect to 127.0.0.1:8778 (connect: Connection refused)

Finally, in the previous examples we used the for-each procedure, that applies a procedure to each element in a list, but returns void. If you want to return a value you may want to use the map procedure instead of for-each.