added output dir
improvde catall to get file type