I have a following directory structure (assume no two files have the same name):
- Apple1
- apple1.jpg
- apple2.jpg
- Apple2
- apple3.jpg
- apple4.jpg
- Apple3
- Tomato
- Peach
And i would like to move one directory to the top directory all the *.jpg
files inside the directories, which names start from Apple
.
As a result I expect the Apple directories to be empty and the images from Apple directories to be in the top.
I have tried doing like mv "Apple*/*.jpg" .
, or find . "Apple*/*.jpg" -exec mv -t . {} +
as prescribed here How to integrate mv command after find command?. But this doesn't work.
When executing mv
i receive a following message:
mv: cannot stat ‘Apple*/*.jpg’: No such file or directory
Seems like it has not found anything matching the pattern. And other option simply outputs nothing. Maybe the reason is, that in the case of subdirectories regular expression needs to be modified?
I would be very grateful for help and suggestions.
mv Apple*/*.jpg .
? – guest_7 Mar 20 '21 at 10:32*.jpg
from directories, which start onApple
to the topl level of the hierarchy. My current solution is most probably a nonsense - and I am asking how to achieve the needed fuctionality. – spiridon_the_sun_rotator Mar 20 '21 at 10:34