【发布时间】:2014-11-27 23:05:51
【问题描述】:
我使用这一行来删除文件夹名称上的空格
find /tmp/ -depth -name "* *" -execdir rename 's/ /_/g' "{}" \;
有没有办法从文件名中删除空格和括号并加上下划线?
例如,我有:
|-- a_dir
| `-- (1) file with spaces and parentheses.pdf
`-- b_dir
|-- (43) another file with spaces (1).pdf
`-- (132) yet another file with spaces (3343).pdf
必须成为
|-- a_dir
| `-- 1_file_with_spaces_and_parentheses.pdf
`-- b_dir
|-- 43_another_file_with_spaces_1.pdf
`-- 132_yet_another_file_with_spaces_3343.pdf
【问题讨论】: