Improve BDirTools

Add writeFile() and writeTextDile() functions.