So I was looking around and all I have found is how to do this only if the directory is already made, which is this:
find source -name '*.z' -exec cp {} destination \;
But how can I make a new directory where I want to send these files in the same command? This is what I have tried but with no success:
find source -name '*.z' -exec cp {} | mkdir newDirectory \;
mkdir newDirectory; find … -exec cp {} newDirectory \;
– Gilles 'SO- stop being evil' Oct 12 '13 at 23:52