updated the directory method to have better long file name support