Copy by extension

Rashkae ubuntu at
Fri Oct 17 16:52:37 UTC 2008

Ed Jabbour wrote:
> I'm looking for an app that will descend into a directory and its subs, find 
> all files with a .foo extension and copy them to the bar directory.  There are 
> a lot of files, so doing it manually would be tiresome.    If cp has that 
> functionality, I can't find it.  Thanks.

Use the find command..

You'll have to research the man page, but the gist of it is, you want
find files based on name '*.foo' or maybe .*foo as a regexp.

Then use find's { } construct to use cp command on the files it finds.

More information about the ubuntu-users mailing list