If I have a directory on which user has read permission why is it not possible to check if there is a file in that directory. For example, let's say I have folder /myfolder with permission read. That folder has some file 'garbage.txt' with permission read (for the user). When I try to use stat /myfolder/garbage.txt I get permission denied error. If I add execute permissions for /myfolder then I can check if garbage.txt exists.
Why is it that I need execute permissions to check if a file in a folder exists. I expected that read permissions on directory/folder would be enough.