当我列出当前的工作目录时会显示文件,但是如果我尝试用它做任何事情,它就不存在

我正在使用AIX服务器。 我今天创build了一个文件,ucm.txt。 现在我已经完成了该文件,并希望将其删除。

如果我在当前目录下执行ls -ltr ,就可以得到这个结果。

-rw-r--r-- 1 barringer myserver 11729 Jul 16 09:11 ucm.txt

如果我试图用文件做任何事情(没有改变目录),我得到这个。

=> rm ucm.txt

rm: ucm.txt: A file or directory in the path name does not exist.

=>更多ucm.txt

ucm.txt: A file or directory in the path name does not exist.

这很可能是文件名中有“坏字符”或空格

你可以试试这个:

ls -1 | 同时读取文件do ls -lsd“$ file”done查看“ls”是否可以find该文件。 如果可以的话,你可以调整这个脚本来删除文件。 但要小心:我提供的这个脚本是列出目录中的所有文件,如果你调整它来删除文件,确保它只会rm你想要的文件。