Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose there is a directory named mydir containing ...


... where a,b are executable files. What I want to is to only copy a and b to another location.

Is it possible ? (other than by manually issuing copy a,b another_dir )

share|improve this question

migrated from May 9 '11 at 11:01

This question came from our site for professional and enthusiast programmers.

up vote 12 down vote accepted

You can run:

find mydir -perm /a+x -exec cp {} destdir \;
share|improve this answer
it works,but directory also in the results of find – camino May 9 '11 at 8:19
Add "-type f" (match files only) – dimba May 9 '11 at 9:20
Great! it works – camino May 10 '11 at 6:43
For some reason, this copied .c and .h files as well as executables on RHEL – SSH This May 17 '13 at 21:09

You should add a rule in your Makefile to install your executable targets.

share|improve this answer
it is a good idea, but it is a temporary work,so I didn't want to write a Makefile for it – camino May 9 '11 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .