Linux - Replacing spaces in the file names

前端 未结 11 661
臣服心动
臣服心动 2021-01-29 18:21

I have a number of files in a folder, and I want to replace every space character in all file names with underscores. How can I achieve this?

11条回答
  •  借酒劲吻你
    2021-01-29 19:01

    I prefer to use the command 'rename', which takes Perl-style regexes:

    rename "s/ /_/g" *
    

    You can do a dry run with the -n flag:

    rename -n "s/ /_/g" *
    

提交回复
热议问题