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 )

link|improve this question

50% accept rate
feedback

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 7 down vote accepted

You can run:

find mydir -perm /a+x -exec cp {} destdir \;
link|improve this answer
it works,but directory also in the results of find – camino May 9 '11 at 8:19
1  
Add "-type f" (match files only) – dimba May 9 '11 at 9:20
Great! it works – camino May 10 '11 at 6:43
feedback

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

link|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
feedback

Your Answer

 
or
required, but never shown

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