I have three levels of folders like main, sub-1 and sub-2. my main folder has lot of sub-1 folders and each sub-1 has lot of sub-2 folder with JPG images inside.
I am trying to find and copy JPG files from sub-2 into its parent sub-1 folder being FROM main folder.
So my current solution is to go to each sub-1 folder and use this script to find and copy all JPG from sub-2 folder into its parent sub-1 folder.
find . -type f -name "*.jpg" -exec cp {} ./ \;
Why this script below not working? how do I find and copy JPG from main folder without going into the each sub-1 folder?
Update I tried this script:
find . -type f -name "*.jpg" -exec cp {} ../ \;
but this brings all the images to the main folder instead of the sub-1 folder.