Best way to rename sequentially 36 files, starting from the 4th file

Hi all,

I’m not a scripter and I’ll happy if I can receive some tips for my trouble…

I’ve to rename a bunch of folder that contains each one 36 files numbered sequentially. I want to:

  • Use as prefix of the containing files of each folder the name of the folder.
  • Starting to rename each files sequentially from _01 to _36.
  • the first file to rename is not the first original but the fourth.

Any tips?

thanks a lot!


for d in find /some/directory -type d -not -name ".*"; do
cd “$d”
for f in *; do
[[ $i -le 3 ]] && continue
mv “$f” "${d}_"printf %02d $i