本文介绍了如何删除带有特殊字符的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Unix文件系统上有一个奇怪的文件.文件名中似乎包含一些特殊字符,但是我无法将其删除.即使我没有直接在rm命令中写名称(而是写了ls | rm),也会收到错误消息,指出该文件不存在.下面是我在互联网上进行几次搜索后尝试使用的一些命令,以调试问题.

I have a weird file on a Unix filesystem. It seems to have some special characters in the file name, but I've not been able to remove it. Even if I don't write the name directly in the rm command (and I do ls | rm instead), I get an error that the file doesn't exist. Below some commands that I've tried after a few searches on the internet, in order to debug the issue.

您对如何删除它有任何建议吗?该系统是AIX 7.1.我也尝试了rmperl脚本(仅列出所有文件并从文件夹中删除所有内容),但没有一个起作用.我也无法将文件夹移动到/tmp,我也遇到同样的错误.

Do you have any suggestions on how to remove it? The system is AIX 7.1. I've tried with rm and a perl script too (simply listing all files and deleting everything from the folder), and none worked. I can't move the folder to /tmp either, I get the same error.

谢谢!

[root@server] ls -1b | od -bc
0000000  342 134 062 060 060 134 062 062 063 012
           ▒   \   2   0   0   \   2   2   3  \n
0000012
[root@server]$ ls -li
ls: 0653-341 The file ./– does not exist.
total 0
[root@server]$ ls
–
[root@server]$ ls | od -bc
0000000  342 200 223 012
           ▒ 200 223  \n
0000004
[root@server]$ rm *
rm: –: A file or directory in the path name does not exist.

屏幕截图

Screenshot

推荐答案

一种相对安全的方法是列出文件的使用ls -i插入节点,然后使用find . -maxdepth 1 -type f -inum $inum -delete删除所需的节点($inum是要删除的索引节点).

A relatively safe way would be to list files' inodes with ls -i and then delete the one you need with find . -maxdepth 1 -type f -inum $inum -delete ($inum is the inode to delete).

感谢您在Unix上! ❤

And be grateful you are on Unix! ❤

这篇关于如何删除带有特殊字符的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:57