write filesystem iteration code