Copy only certain file types from a folder structure to another

file-copyfilesrecursive

I have a top folder with many sub-folders. It's named "a". There are many .png and .jpg files in there. I'd like to recursively copy "a" into a new folder "b", but only copy the .png and .jpg files. How do I achieve that?

Best Answer

find a \( -name "*.png" -or -name "*.jpg" \) -exec cp {} b \;
Related Question