replace readFileSync by readdir