use ec_file:is_dir/2 within ec_file