read and write dirs and files from a file