Unix File Management – How to Move or Copy All Files of a Certain Type to Directory

file-copygreprename

I'm not very familiar with all the tricks of grep/find/awk/xargs quite yet.

I have some files matching a particular pattern, say *.xxx. These files are in random places throughout a certain directory. How can I find all such files, and move them to a folder in my home directory on Unix (that may not exist yet)?

Best Answer

mkdir ~/dst
find source -name "*.xxx" -exec mv -i {} -t ~/dst \;
Related Question