Copy by extension

Neil hok.krat at gmail.com
Tue Oct 21 07:57:36 UTC 2008


On Fri, Oct 17, 2008 at 7:13 PM, Nils Kassube <kassube at gmx.net> wrote:
> 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 this:
>
> find -name \*.foo -exec cp {} bar \;
>
> However if you might have multiple files with the same name you will end
> up with only one of them in the bar directory. You can check if you have
> that problem with this command:
>
> find -name \*.foo -exec basename {} \; | sort | uniq -d
>
>
> Nils
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>

hi

just curious: would cp -R *.foo /path/to/destination/ do the trick? Or
would it recreate the directory structure in the destination
directory?

Neil

-- 
There are three kinds of people: Those who can count, and those who cannot count
-----------------------------------------------------------------------
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
-----------------------------------------------------------------------




More information about the ubuntu-users mailing list