ls: cannot access file: No such file or directory
Solution 1
ls: cannot access Downloads: No such file or directory total 56 d????????? ? ? ? ? ? Downloads drwxr-xr-x 26 user 12288 Aug 12 23:29 foo
This is a typical case of having only read perms on a dir and no exec perms. And the other command outputs give the show that you don't have write perms either. To understand why this happens you'll have to know about inodes, dentries and the path lookup process of the kernel
Solution 2
D, you haven't described the situation around the issue, but here goes,
First does the directory appear in your file manager? According to your listing
d????????? ? ? ? ? ? Downloads
The directory "exists" but, without any discernable/set/assigned permissions, nor does it belong to a user or a group. In fact, on the face of it, read access is completely blocked. Again, describe the situation around this issue, meaning how did you arrive at this point?.
As an experiment , boot a live distro, and access that way, get the listing for Downloads and either assign "standard" directory permissions 755 or delete the directory. From time to time i have experienced what seem to be "bad writes" of files with the same issue and have had to jump to a live distro to delete them from my daily driver. If you CAN access the Download directory from the live distro, then recover it's contained data "off world" before you delete the directory. It's better to recreate the directory correctly once you are back in normal operation.
Related videos on Youtube
Beefy_Swain
Updated on September 18, 2022Comments
-
Beefy_Swain almost 2 years
Context: I added a drive to my machine, and for whatever reason, I am unable to access a directory(?) on it.
ls -l
ls: cannot access Downloads: No such file or directory total 56 d????????? ? ? ? ? ? Downloads drwxr-xr-x 26 user 12288 Aug 12 23:29 foo
ls -a
. .. Downloads foo
cd
bash: cd: Downloads: No such file or directory
touch
touch: cannot touch ‘Downloads’: File exists
mkdir Downloads
mkdir: cannot create directory ‘Downloads’: File exists
cat Downloads
cat: Downloads: No such file or directory
file Downloads
Downloads: cannot open `Downloads' (No such file or directory)
mv Downloads down
mv: cannot stat ‘Downloads’: No such file or directory
Furthermore, the following commands do not remove the file(?), as root or otherwise:
rm Downloads rm -rf Downloads rmdir Downloads
One more piece of information, bash auto-completes Downloads, so bash also seems to think it is there.
-
Zumo de Vidrio over 7 yearsPerhaps your filesystem has been corrupted. Are you able to do any action in a different OS?
-
Kit about 7 yearsI would say that the metadata is corrupted or unreadable by the current OS. If you "repair" it there, it may work or it may become permanently inaccessible anywhere. Proceed with caution (and backups)
-
Foo Bar almost 7 yearsPerhaps this is the same as askubuntu.com/questions/548930/…
-
-
Beefy_Swain almost 9 yearsupdated post with contex
-
r0berts over 7 yearsIt would be nice to be more specific - e.g. by booting a live distro, or on reboot. Maybe you found what the core problem was - e.g. improperly unmounted network share, or permissions on his new disk that do not make sense to his current system, etc.
-
Kamil Maciorowski almost 6 yearsHow will sole unmounting help? It's like repairing a car by putting it out of sight. If the link leads to the real solution, please cite it here; the target site may change or disappear. Is the solution substantially different than what other answers suggest?
-
sbecker almost 3 yearsI have no idea how unmounting helps. But it did help for me. I had mounted an smb share to that directory. The smb share didn't exist anymore though. After unmounting, I was able access the directory as per usual.
-
Community over 2 yearsYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.