added optional "recurse" param to prevent recursion on subdirectories