In bash how would one output the non-readable contents of a directory?
For example, let’s say the directory is ~/foo, and there’s a non-readable folder ~/foo/folder with a file ~/foo/folder/file1.txt, and another non-readable file ~/foo/file2.txt. I want to output:
~/foo/folder cannot be read.
~/foo/folder/file1.txt cannot be read.
~/foo/file2.txt cannot be read.
If you cannot read folder
~/foo/folder, there’s no way for you to detect any files in it, be they readable or not.If you can read
~/foo, you can go over all files and directories and test, wether they are readable or not: