Is this method referring only to files or directories are also acceptable? If so, please add isDirectory() check