I have multiple directories, and each one of those directories contains an "example" directory which in turn contains images. What I want to do, is to add a textual suffix at the end of a filename (but which precedes the extension) to each file and then copy the contents of the directory into its respective parent directory.
Basically I want the files from /maindir/dir1/example/, /maindir/dir2/example etc. to be renamed and copied/moved to their respective parent directories, i.e. dir1 and dir2. The contents of all "example" dirs are images with a .jpg extension. I don't know if I am going about this the right way but I managed to figure out how to do the copying part by doing this:
find /path/to/folder/ -type d -name example -execdir bash -c 'cp "$1"/* .' cp {} \;
which copies the content into the parent folder correctly, but I'm kinda stumped on how do I go about adding a suffix to the copied files while using find.