【发布时间】:2020-11-23 02:28:35
【问题描述】:
我需要递归地将 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"
错误消息:在(用户提供的代码)使用“严格的 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”
【问题讨论】:
-
看起来所有文件最终都只有一个名称,不是吗?
-
能否提供搬家前后的目录样本?
-
我有 20 个子目录,每个子目录都有一个名为 "bash-sdl2-compile.sh" 的文件,我需要将其更改为 "compile.sh" 我显示的代码发布在“堆栈服务器”上
-
@jwzumwalt :在我看来,您的错误消息好像是由 Perl 程序发出的。除此之外,您发布的代码中没有裸词 bash。
标签: linux bash file-rename mv