BASH复制所有文件,除一 [英] BASH copy all files except one
本文介绍了BASH复制所有文件,除一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想所有文件复制出来迪尔除了一个名为为Default.png。似乎有很多方法可以做到这一点。什么似乎是最有效的吗?
I would like to copy all files out of a dir except for one named Default.png. It seems that there are a number of ways to do this. What seems the most effective to you?
推荐答案
简单,如果的src /
只包含文件:
Simple, if src/
only contains files:
find src/ ! -name Default.png -exec cp -t dest/ {} +
如果的src /
有子目录,这忽略了它们,但它们复制里面的文件:
If src/
has sub-directories, this omits them, but does copy files inside of them:
find src/ -type f ! -name Default.png -exec cp -t dest/ {} +
如果的src /
有子目录,这不递归到他们:
If src/
has sub-directories, this does not recurse into them:
find src/ -type f -maxdepth 1 ! -name Default.png -exec cp -t dest/ {} +
这篇关于BASH复制所有文件,除一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文