可能的重复:
在 OS X 中删除文件名中包含奇怪字符的文件
我有一个文件夹,其中包含一个名为 Icons 的文件,并以附加的不可打印字符结尾。如果我使用 -B 选项,我可以看到无法打印的内容:
$ ls -B
$ Icon\015
Run Code Online (Sandbox Code Playgroud)
如果我使用 ls -b 我得到:
$ ls -b
$ Icon\r
Run Code Online (Sandbox Code Playgroud)
我想删除文件,但找不到输入不可打印字符的方法。如果我做:
$ rm Icon\015
Run Code Online (Sandbox Code Playgroud)
我得到:
$ Icon\015: No such file or directory
Run Code Online (Sandbox Code Playgroud)
如果我做:
$ rm Icon\r
Run Code Online (Sandbox Code Playgroud)
我得到:
$ Icon\r: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我可以删除整个文件夹,但我需要一种更通用的方法来执行此操作,因为此类文件会在许多用户文件夹中弹出。