initialize dir and file descriptor