[lib] improved dirents template