请您帮我查找语法。我正在尝试复制此命令的效果,该命令将打开每个指定子目录中的所有文件:
open mockups/dashboard/* mockups/widget/singleproduct/* mockups/widget/carousel/*
我想让它适用于模型下面的任何子目录。
我可以用:
显示所有子目录find mockups -type d -print
但我不确定如何使用xargs添加“*”。另外,我不想为每个文件单独执行打开“-exec open {} \;”,因为它启动了50个不同的Preview副本,当我需要的是一个预览实例,其中加载了50个文件
谢谢!
答案 0 :(得分:2)
我手头的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 {} +