你能帮我找语法吗?我正在尝试复制此命令的效果,该命令打开每个指定子目录中的所有文件:
open mockups/dashboard/* mockups/widget/singleproduct/* mockups/widget/carousel/*我想让它在模型下面的任何一组子目录下都能工作。
我可以用以下命令显示所有子目录:
find mockups -type d -print但是我不确定如何使用xargs添加"*“。此外,我不想使用"-exec open {} \;“为每个文件单独执行open,因为这会启动50个不同的预览副本,而我需要的是一个预览版实例,其中加载了50个文件。
谢谢!
发布于 2013-05-08 23:36:07
我手头上的find版本允许在-exec参数后指定一个+符号:
从手册页:
-exec command {} +
This variant of the -exec action runs the specified command on the
selected files, but the command line is built by appending each
selected file name at the end; the total number of invocations of
the command will be much less than the number of matched files.
The command line is built in much the same way that xargs builds
its command lines. Only one instance of `{}' is allowed within
the command. The command is executed in the starting directory.这意味着将执行尽可能少的open实例,例如:
find mockups -type f -exec open {} +https://stackoverflow.com/questions/16444018
复制相似问题