Roughly, I have a folder setup like this on a linux server:
/show/season01/show01/shows01e01.mkv /show/season02/show01/shows02e01.mkv /show/season03/show01/shows03e01.mkv
I want to eliminate the folders.... I want to copy the *.mkv
files to the /show/
directory...
Can someone help me out with this one?
find /show -name "*.mkv" -exec cp {} /show/ \;
will do the trickAlex's answer is fine. Here's a couple of alternate ways to do it too:
find + xargs:
find /show -name "*.mkv" -print0 | xargs -0 -Imkv cp mkv /show/
find + parallel:
find /show -name "*.mkv" -print0 | parallel -0 -j+0 cp {} /show/
the only interesting thing about using parallel instead of
find/exec
is that it can execute multiple commands in parallel. The-j+0
arguments will make it launch as many jobs at once as there are cpu cores. That might not be particularly useful if this operation is completemy disk-bound, but potentially it could speed up copying large numbers of files.