why don't you just use buildDirectoryFile? add comment here if you have another concern.