Number listed dirs and support popping by index.