I have files as follows: (Some files are located inside nested folders)
/1/asd.m
/3/asd.m
/4/2/asd.m
I want to rename .m files with a suffix of their parent folder name. The result should be like this:
/1/asd1.m
/3/asd3.m
/4/2/asd2.m
How can I do this on Mac terminal?