How to rename all files in all sub directories, with the sub directories name and auto number.
ex:
parent
-subdir
--file.jpg
--cat.jpg
--dog.jpg
rename to :
parent
-subdir
--subdir_01.jpg
--subdir_02.jpg
--subdir_03.jpg
I'm using this script but it's not recursive
#!/bin/bash
a=1
b="$1"
for i in *.jpg; do
new=$(printf "%04d" ${a}) #04 pad to length of 4
mv "${i}" ""$1"_${new}.jpg"
let a=a+1
done