【问题标题】:Use terminal to find and change files with a certain name使用终端查找和更改具有特定名称的文件
【发布时间】:2017-03-15 04:57:26
【问题描述】:

我有一个目录,其中包含多个文件夹,所有文件夹都有一个app.py 文件。使用终端我希望能够找到这些文件,将它们的名称更改为bot.py

我想我不必使用终端,但不想手动操作。

【问题讨论】:

  • 抱歉,这个 Q 与 StackOverflow 定义的编程无关。它可能在 S.E. 上更合适。相关站点 superuser.com 或 unix.stackexchange.com(Unix 和 Linux)。使用 Q 底部的flag 链接并要求版主移动它。请不要在 2 个不同的网站上发布相同的 Q。请先阅读stackoverflow.com/help/how-to-askstackoverflow.com/help/dont-askstackoverflow.com/help/mcve,然后再在此处发布更多问题。祝你好运。
  • find . -name '*app*'find -exec ... 玩得开心:-)
  • 好吧基本上man find

标签: bash replace terminal find


【解决方案1】:
while read file; do
    ...
    mv "${file}" "bot.py"

done < <(LC_ALL=C find . -type f -name 'app.py')

如果您想执行其他步骤。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-28
    • 2012-06-14
    相关资源
    最近更新 更多