Linux - How can I copy files of the same extension located in several subdirectories into a single directly?
If you're on a system with GNU cp
, this will do it faster:
find /path/to/src -name "*.nr" -print0 | xargs -0 cp -t /path/to/dest
Copying all .c
files under my src
dir:
time find ~/src -name "*.c" -exec cp \{\} ~/src/Cfound/ \;. . .real 0m1.838suser 0m9.530ssys 0m1.110stime find . -name "*.c" -print0 | xargs -0 cp -t ./Cfound/. . .real 0m0.057suser 0m0.010ssys 0m0.060s