[英]How to use "find ... -exec ..." correctly to move all files and directories except a few?
I'm trying to move all files from a directory except some files(or directories).我正在尝试从目录中移动除某些文件(或目录)之外的所有文件。 How I am doing:
我是怎么做的:
sudo find. ! -name 'myarq.sh'! -name '.mydir'! -name '.' ! -name '..' -exec mv {} ./* .mydir
but I get:但我得到:
find: missing argument for "-exec"
I am not aware of using the "-exec" probably, I do not know which syntax is correct for the above case.我可能不知道使用“-exec”,我不知道对于上述情况哪种语法是正确的。
In general, the error message find: missing argument for "-exec"
means that you failed to properly terminate the command, either with a ;
通常,错误消息
find: missing argument for "-exec"
表示您未能正确终止命令,或者使用;
or +
.或
+
。 Try:尝试:
find ... -exec mv {} .mydir \;
Some implementations of find
will give a performance benefit by using +
(fewer subshells will be spawned): find
一些实现将通过使用+
提高性能(将产生更少的子shell):
find ... -exec mv {} .mydir +
Note that the +
does not need to be escaped to the shell, but the ;
请注意,
+
不需要转义到 shell,但是;
does.做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.