I have a list of jpeg files in a directory like this (below is just a sample, like the structure is the same but this there are many fo0# sub-folders, not only fo01 and fo02, where each of these subfolders has many .jpeg images, not only two):
.
`-- main
|-- ccc
| |-- fo01
| | |-- ccc_fo01_c_000.jpeg
| | `-- ccc_fo01_c_001.jpeg
| `-- fo02
| |-- ccc_fo02_c_000.jpeg
| `-- ccc_fo02_c_001.jpeg
|-- ddd
| |-- fo01
| | |-- ddd_fo01_d_000.jpeg
| | `-- ddd_fo01_d_001.jpeg
| `-- fo02
| |-- ddd_fo02_d_000.jpeg
| `-- ddd_fo02_d_001.jpeg
`-- lll
|-- fo01
| |-- lll_fo01_l_000.jpeg
| `-- lll_fo01_l_001.jpeg
`-- fo02
|-- lll_fo02_l_000.jpeg
`-- lll_fo02_l_001.jpeg
What I want to do is to loop on the main directory on each of ccc, ddd and lll, so that in the each iteration of the loop the jpeg images of one of the subfolders will be copied to the parent location. So in the above example, in the first iteration of the loop this will happens:
ccc_fo01_c_000.jpegandccc_fo01_c_001.jpegwill be copied(not moved) fromccc/fo01tocccddd_fo01_d_000.jpegandddd_fo01_d_001.jpegwill be copied(not moved) fromddd/fo01todddlll_fo01_l_000.jpegandlll_fo01_l_001.jpegwill be copied(not moved) fromlll/fo01tolll
and in the end of the first iteration, those copied jpegs (in ccc ddd lll) will be deleted from ccc ddd lll so that as if I didn't make the copying.
Same with every iteration on the subfolders. So this means that in the above example, the copying then deleting process will happen two times as there are two subfloders fo01 and fo02. But in my case there are more subfolders. So if anyone could please advise how this can be done.