- 论坛徽章:
- 0
|
本帖最后由 zyq2006 于 2013-10-18 17:30 编辑
谢谢各位大侠指点。
详细情况是:网上下载了一些文件,在UBUNTU里保存时,名字中含有:()等符号。
传到移动硬盘后,再往win7里复制时错误。(由于名字不支持)
文件很多,在一个目录下的多个子目录下2层里
想在UBUNTU里先删掉冒号
find . -type f -name "*:*.txt" -exec rename 's/:/_/g' {} \;
会出现
Can't rename ./kecheng/Web Intelligence and Big Data/Unit 6: Connect/7 - 4 - 6-4 Semantic Web (6:1).txt
./kecheng/Web Intelligence and Big Data/Unit 6_ Connect/7 - 4 - 6-4 Semantic Web (6_1).txt: 没有那个文件或目录
从错误信息中直接选取不能执行的操作,在命令行中执行
yq@yq-Inspiron-530:~/kecheng$ rename ./Networks: Friends, Money, and Bytes /Lecture 1 (Version 1): What makes CDMA work for my smartphone?/2 - 18 - Components of a Game (2:20).txt ./Networks_ Friends, Money, and Bytes /Lecture 1 (Version 1)_ What makes CDMA work for my smartphone?/2 - 18 - Components of a Game (2_20).txt
bash: 未预期的符号 `(' 附近有语法错误
所以怀疑是由于文件名中有(导致不能成功替换
但是,如果某文件夹下有若干需要改名的文件,‘a:w().txt’,‘a(w:e).txt’,可以
rename 's/:/_/' *.txt
去掉其中的冒号,(并不影响替换
|
|