There are two predicates that are useful here: file-exists?, which returns #t if a file name corresponds to a file, but not to a directory, and directory-exists?, which returns #t if a file name corresponds to a directory, but not to a file. You can use directory-exists? with directory-list and filter to create a list of file names that correspond only to directories: