如何在linux中只复制可执行文件(或没有扩展名的文件)?

cam*_*ino 4 linux

假设有一个名为 mydir 的目录,其中包含...

aaa.cpp
aaa.h
bbb.cpp
bbb.h
Makefile
a 
b
Run Code Online (Sandbox Code Playgroud)

... 其中 a,b 是可执行文件。我想要的是只将 a 和 b 复制到另一个位置。

是否可以 ?(手动发行copy a,b another_dir除外)

dim*_*mba 20

你可以运行:

find mydir -perm /a+x -exec cp {} destdir \;
Run Code Online (Sandbox Code Playgroud)

  • 添加“-type f”(仅匹配文件) (4认同)

nin*_*alj 5

你应该在你添加一个规则Makefile,以install你的可执行目标。