谁能推荐一种安全的解决方案,从给定的根目录开始用文件名和目录名中的下划线递归替换空格?例如:
$ tree
.
|-- a dir
| `-- file with spaces.txt
`-- b dir
|-- another file with spaces.txt
`-- yet another file with spaces.pdf
变成:
$ tree
.
|-- a_dir
| `-- file_with_spaces.txt
`-- b_dir
|-- another_file_with_spaces.txt
`-- yet_another_file_with_spaces.pdf
foo bar
,又有另一个名为的文件,您想怎么办foo_bar
?