Posts Tagged ‘copy multiple files’

Move multiple files from command line

15, March 2011

Using find to copy or move multiple files

All the .txt files are located in directories and subdirectories of the ~/tmp folder and I want to copy them to ~/tmp2

To copy them, open a Terminal and use;

$ find ~/tmp -name ‘*.txt’ -exec cp ‘{}’ ~/tmp2 \;

This copies all the files in the original folders and sub folders and saves them to the ~/tmp2 folder.

or to move them,

$ find ~/tmp -name ‘*.txt’ -exec mv ‘{}’ ~/tmp2 \;

this deletes them from the original folders and sub folders and saves them to the ~/tmp2 folder.

Advertisements