Reputation: 93
I have several folders like so:
I'm looking to grab all jpg files containing "fanart" as well as all jpg contents of each extrafanart folder, and copy these all to a single folder like so:
I've gotten this far:
find . -type f \( -iname "*.jpg" -iname "*fanart*" \) -exec cp '{}' fanart \;
But I can't figure out an efficient way to grab the contents of the extrafanart folders. Ideas?
Upvotes: 0
Views: 18
Reputation: 781310
Use -o
to specify different criteria. You can use the -path
option to match files in a subdirectory
find . -type f \( -name '*fanart.jpg'* -o -path '*/extrafanart/*.jpg' \) -exec cp {} fanart \;
Upvotes: 1