如何删除文件名中含“-”的文件
时间:2005-10-17 来源:wangzhixu
如何删除文件名中含“-”的文件
对于文件名中含-的文件,rm命令容易认为这是命令选项,用rm *报:
rm: ERROR: Illegal option -- c
usage: rm [-fiRr] file...
删除的方法:
1 rm ./-filename 这样使-不是第一个字符。
2.rm -- -filename 用--告诉rm这是最后一个选项,参见getopt。有的系统用
rm - -filename
3.ls -i 列出inum ;用find . -inum inum_of_thisfile -exec rm '{}' ;
用这种方法可以删除含特殊字符的文件。
其它方法,一起贴出来。
相关阅读 更多 +