我有一个 Linux 项目。我想在所有文件夹中创建一个名为 index.html
的文件。
所以我使用了以下命令:
find . -type d -exec touch {}/index.html \;
它的工作!现在,我正在尝试从给定位置复制现有文件,并将其自动替换到我项目的所有文件夹中。
最佳答案
这实际上应该以完全相同的方式工作:
find . -type d -exec cp $sourcedir/index.html {}/index.html \;
关于linux - 在 Linux 中创建文件并替换内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5702702/