Rename files and directories recursively under ubuntu /bash

后端 未结 8 1167
执念已碎
执念已碎 2020-11-29 18:50

I want to rename all files and directories that contain the word \"special\" to \"regular\". It should maintain case sensitivity so \"Special\" won\'t become \"regular\".

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 19:39

    If you don't mind installing another tool, then you can use rnm:

    rnm -rs '/special/regular/g' -dp -1 *
    

    It will go through all directories/sub-directories (because of -dp -1) and replace special with regular in their names.

提交回复
热议问题