I'm trying to rename several directories adding dashes after fourth and sixth characters. I looked at this post How do I loop through only directories in bash? and was able to successfully loop through the directories that I wish to insert the dashes into. However, after seeing this Rename files add dashes after fourth and sixth characters I though perhaps I could use similar syntax on directories, but after doing so realized it can't be done that way. This was my syntax:
for d in */ ; do
mv “$d" “${d::4}-${d:4:2}-${d:6}"
done
I searched through SE and didn't see another post like this. I apologize in advance if this question is answered elsewhere.
Also, thank you in advance for any help you might offer. Best, Jon