Find and replace filename recursively in a directory

前端 未结 14 2042
野趣味
野趣味 2020-11-28 21:24

I want to rename all the files in a folder which starts with 123_xxx.txt to xxx.txt.

For example, my directory has:

123_xxx         


        
14条回答
  •  情话喂你
    2020-11-28 22:03

    In case you want to replace string in file name called foo to bar you can use this in linux ubuntu, change file type for your needs

    find -name "*foo*.filetype" -exec rename 's/foo/bar/' {} ";"
    

提交回复
热议问题