Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Suppose there is a directory named mydir containing ...

aaa.cpp
aaa.h
bbb.cpp
bbb.h
Makefile
a 
b

... 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
add comment

migrated from stackoverflow.com May 9 '11 at 11:01

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

2 Answers

up vote 8 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
2  
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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.