Copying files whilst flattening the directory structure

I just had to copy a load of PNGs, whilst at the same time flattening the directory structure. After a while of playing about I came up with this:

find . -iname '*.png' -exec cp \{\} "<PATH TO DESTINATION>" \;

This recursively takes every png file from the current directory hierarchy and copies it to the destination directory.

Handy, no?

Leave a Reply