Added methods to read a file or a directory