library(directory) provides Prolog routines for scanning directories and checking properties of files. See also absolute_file_name/2 in the reference pages, and library(files).
library(directory)
absolute_file_name/2
library(files)