linux递归重命名文件名

jwzumwalt:

我需要递归地将bash-sdl2-compile.sh重命名compile.sh
尝试使用“重命名”失败,显然安全功能不允许使用“ bash”一词,即

find ./ -name "bash-sdl2-compile.sh" -print0 | xargs -0 rename "bash-sdl2-compile.sh" "bash-sdl2-compile/compile"

错误消息:在(用户提供的代码)使用“ strict subs”时,不允许使用标语“ bash”。xargs:重命名:以状态255退出;流产

如何递归重命名linux文件?

    dir1
       |_project1
                |_ bash-sdl2-compile.sh
    dir2
       |_project2
                |_ bash-sdl2-compile.sh
    dir3
       |_project3
                |_ bash-sdl2-compile.sh
  . . . 

因此,将每个“ bash-sdl2-compile.sh”重命名为“ compile.sh”

xhienne:

无需使用xargsfind就足够了:

find . -name bash-sdl2-compile.sh -execdir mv -i {} compile.sh ";"

(尝试此操作之前,请备份整个树)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章