Fix rebuild-index.sh to work with sha subdirs.