无法删除文件 – 没有此类文件或目录
如何删除那里的文件,但系统说不存在?
我有同样的问题。 这是分区的索引条目中的问题。 如果您的系统是双启动或插入Windows XP或Windows 7的Live CD,我通过启动Windows解决了它,然后执行以下步骤:
- 搜索命令PROMPT:
cmd
右键单击 – >以管理员身份运行。 -
chkdsk /f/x D:
其中D是你的驱动器号)。 - 如果要求Y / N,请按Y.
- 检查驱动器以查找要删除的文件。 也许它已删除或您可以删除它。
100%工作
警告:这些说明将要求使用
debugfs
。 它们可能导致数据丢失。它们是针对原始问题量身定制的,对于此页面上的任何未来访问者而言可能准确,也可能不准确。 任何数据丢失都可能是
fsck
无法修复甚至加剧的。
它可能是一个丢失的inode。 请运行ls -li
以获取inode编号列表,然后您可以尝试转储引用的inode。 例如,如果您的ls -li
如下所示:
rarkenin@ubuntu-alt-64-vbox-1:~$ ls -li total 58672 4980758 -rwxr-xr-x 2 rarkenin rarkenin 4096 Sep 23 18:45 panorama.jpg ---SNIP---
然后inode编号为4980758,如列表中第一列所示。
然后,您可以尝试转储inode。 在做任何事之前请阅读整篇文章。
-
以root身份启动
debugfs
:rarkenin@ubuntu-alt-64-vbox-1:~$ sudo debugfs [sudo] password for rarkenin: debugfs 1.42 (29-Nov-2011) debugfs:
并为命令
open /dev/sda1
提供正确的分区块设备。 -
然后,命令转储您之前获得的编号的inode:
cat <4980758>
在inode编号周围使用
<
和>
。 -
如果它读取一些随机文本,请关闭终端并再次打开它。 再次运行
debugfs
并再次发出open
命令。 -
现在,您可以尝试删除该文件。 这可能导致严重的文件系统损坏。
debugfs: rm [filename] debugfs: unlink [filename] debugfs: kill_file [filename] debugfs: kill_file
请注意,即使事实certificate文件从未有过inode,也可以这样做。 按照上面显示的顺序逐个尝试一个命令。 退出debugfs并检查文件是否存在。 如果没有,请重新开始,但按照下一条说明操作。
尽可能做好备份!
我知道这是旧的,但我和你的问题一样,只有一个文件夹,而不是文件。 这里建议的方法都没有用。
我设法通过创建一个与我无法删除的文件夹位于同一位置且名称相同的文件夹来解决问题。 该文件夹已正确创建,并“替换”了不存在的文件夹。 然后我只是删除了新文件夹,问题就消失了。 就这样。
告诉我们终端….做一个ll | grep panorama
ll | grep panorama
并告诉我们; 将其添加到您的问题中……
我的建议是以root身份做rm -f panorama.jpg
。
在rm的人我发现了这个:
-f, --force ignore nonexistent files, never prompt
首先使用sudo -s
以root身份登录
您可以尝试执行rm -v
并查看详细输出以查看在尝试删除文件时发生的事情。 查看以下命令的选项。
如果失败,您可以像其他人说的那样使用强制选项。 您也可以尝试通过强制递归删除来删除整个目录: rm -rfv **full directory address here**
从UNIX命令指南:
概要
rm [OPTION]... FILE...
描述
rm removes each file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped.
OPTIONS
Remove (unlink) the FILE(s). -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal --no-preserve-root do not treat '/' specially (the default) --preserve-root fail to operate recursively on '/' -r, -R, --recursive remove directories and their contents recursively -v, --verbose explain what is being done --help display this help and exit --version output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a '-', for example '-foo', use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred.
查看截图,我看到您将组设置为root。 我尝试使用chown,看看它是否解决了问题。
sudo chown -hR [username]:[username] /home/[username]
用您的用户名替换[username]。
你会得到一些错误。
文件名中的非打印字符可能会导致此类问题 – 如空格。 尝试使用rm的交互式选项,并对要删除的文件说“Y”
rm -i“* pan *”注意使用* s匹配任何(甚至非打印)字符。
可能是inode已被删除,但不是目录条目。 尝试使用ls -i查看inode。 fsck文件系统来解决这类问题。
试试这种方式:
cd dir-to-delete find ./ -exec rm -rf {} \;
正如ubfan1所说,文件名中的非打印字符可能会导致此类问题。
- 触摸
- R M
为我工作,因为’touch’覆盖了损坏的文件。
我对Chrome下的自定义网络基础EMR(电子病历)创建的文件存在同样的问题。 sudo touch /forcefsck
然后重启为我工作和aromatically删除文件。 采取以下页面的帮助表格
Linux Mint 18.3我不存在的文件是¨filename.pdf.crdownload¨它在我的桌面上显示为一个包,即Windows中的一个zip文件。 对于它,我点击右键,属性,打开,显示零应用程序,所以我将其更改为打开带有“存档管理器”。 文件立即从我的桌面上消失了。 KB