无法通过节点号删除目录

无法通过节点号删除目录

我有一个空目录,无法重命名或删除,即使我尝试按节点号删除它也是如此。下面显示了我尝试过的命令。我看到的唯一异常是 shell 的文件名补全在文件名后附加了一个斜杠(如 rmdir 命令所示)。欢迎任何建议。文件系统是ext4。

$ ls
'Every Breath You Take: The Classics'

$ ls -bl
ls: 'Every Breath You Take: The Classics': No such file or directory
total 0
drwxrwxrwx 1 user user 0 Nov 28  2014 Every\ Breath\ You\ Take:\ The\ Classics

$ rmdir "Every Breath You Take: The Classics"/
rmdir: failed to remove 'Every Breath You Take: The Classics/': No such file or directory

$ stat "Every Breath You Take: The Classics"
stat: cannot stat 'Every Breath You Take: The Classics': No such file or directory

$ stat "Every Breath You Take: The Classics"/
  File: Every Breath You Take: The Classics/
  Size: 0           Blocks: 0          IO Block: 16384  directory
Device: 37h/55d Inode: 7323        Links: 1
Access: (0777/drwxrwxrwx)  Uid: ( 1000/ user)   Gid: ( 1000/ user)
Access: 2020-05-27 21:18:31.130341500 -0700
Modify: 2014-11-28 23:14:32.000000000 -0800
Change: 2019-02-02 13:27:19.052670600 -0800
 Birth: -

$ find . -inum 7323 -exec rmdir {} \;
rmdir: failed to remove './Every Breath You Take: The Classics': No such file or directory
find: ‘./Every Breath You Take: The Classics’: No such file or directory

以下是几个响应者建议的输出:


$ ls | hexdump -C
00000000  45 76 65 72 79 20 42 72  65 61 74 68 20 59 6f 75  |Every Breath You|
00000010  20 54 61 6b 65 3a 20 54  68 65 20 43 6c 61 73 73  | Take: The Class|
00000020  69 63 73 0a                                       |ics.|
00000024

$ rmdir *Every*
rmdir: failed to remove 'Every Breath You Take: The Classics': No such file or directory

$ rm -i -r Every*
rm: descend into directory 'Every Breath You Take: The Classics'? y
rm: cannot remove 'Every Breath You Take: The Classics': No such file or directory

答案1

解决了!花了一年多的时间,但我找到了解决方案。

事实证明,有问题的目录位于网络附加存储设备上。所以我曾经ssh直接连接到设备,当我检查目录时它显示正常。我能够使用标准rmrmdir命令删除内容,然后删除目录本身。

为什么该目录无法响应桌面上的正常命令仍然是一个谜。

答案2

看起来勾号 (') 几乎是文件名的一部分:

$ ls
'Every Breath You Take: The Classics'

你不能简单地说:

$ rm 'Every Breath You Take: The Classics'

因为壳会吃掉蜱虫。

相反,请尝试:

$ rmdir  *Every*

相关内容