相关疑难解决方法(0)

如何使用bash脚本替换文件名中的空格

任何人都可以推荐一个安全的解决方案,从给定的根目录开始递归地用文件和目录名称中的下划线替换空格?例如:

$ tree
.
|-- a dir
|   `-- file with spaces.txt
`-- b dir
    |-- another file with spaces.txt
    `-- yet another file with spaces.pdf
Run Code Online (Sandbox Code Playgroud)

变为:

$ tree
.
|-- a_dir
|   `-- file_with_spaces.txt
`-- b_dir
    |-- another_file_with_spaces.txt
    `-- yet_another_file_with_spaces.pdf
Run Code Online (Sandbox Code Playgroud)

linux bash filenames whitespace

244
推荐指数
8
解决办法
23万
查看次数

标签 统计

bash ×1

filenames ×1

linux ×1

whitespace ×1