Could have used reject {} to exclude '.' and '..', but I think this is acceptable.