I have a huge directory that is made up of a lot of sub-directories. How do I flatten the images in such a way that they appear on top of the other, and rename them to the subdirectory they were in?
For example, how to rename dir1/dir2/dir3/dir4/XYZ.jpg
to dir1__dir2__dir4.jpg
using $bash?
Thanks in advance