Originally published at: https://www.cyberciti.biz/faq/how-to-rename-multiple-folders-in-linux-using-command-line/
I am new to Linux programming and bash shell commands. I have a folder structure as dir1, dir2, dir3 and I would like to rename it as dir001, dir002, dir003. How do you rename multiple folders in Linux?
Use a “for loop”.
for i in 1 2 3;do mv dir$i dir00$i;done
or
for i in $(seq 3);do mv dir$i dir00$i;done
1 Like