Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有很多目录。我需要到cd所有目录并创建 2 个文件。我尝试使用 xargs 执行此操作,但我做不到。你能告诉我如何实现这一目标吗?
cd
如果您不想或不需要运行find但有一个目录列表,如下所示:
find
xargs -i touch {}/a {}/b <directories.txt
如果目录路径是完全规则的(例如所有子目录向下两层),它可能就像
touch */*/a */*/b
find <path> -type d -exec touch {}/a {}/b \;
路径可能是。如果您已经在您感兴趣的顶级目录中。