Implemented saving to and reading from file for directories.