How to change file names in different folders? I have lots of files with identical name, say "hello.jpg".

They are located in many folders, say

\aaa\hello.jpg
\bbb\hello.jpg
\adaage\hello.jpg


I want to change their name to 

\aaa\aaa_hello.jpg
\bbb\bbb_hello.jpg
...


How can I accomplish this?
You can run this command in Terminal:

find . -name hello.jpg -exec bash -c 'mv "$1" "${1%/*}"/"$(echo $(dirname "$1")_$(basename "$1"))"' -- {} \;


This will find all hello.jpg files inside directories and prepend dir name in front of the filename. NOTE: this search only inside current dir You're in - not the whole partition.

EDIT: fixed spaces in dir/filename.