stat has no problem operating on hidden files. It is the usual convention on Unix-like systems for programs to ignore files and directories starting with a
. by default, but it doesn't prevent those programs from seeing or acting on such files if they are explicitly specified.
The error means exactly what it says;
stat tried to operate on a file or directory that does not exist. This is most likely because your code generated a file listing first, then while iterating over the list,
.../info/subory was deleted or renamed or moved before your code could get to it.
Given the name of the parent directory, it's probably something as simple as the trash on your desktop being emptied while your code was running, either manually or through some automated process.
For transient problems like this, the simplest solution is to simply ignore the error, and maybe skip to the next loop iteration:
stat -c%s $i 2>/dev/null || continue
Or assign a default value (using
-1 to signal that something went wrong, since
0 would be a valid size):
size=$(stat -c%s $i || echo -1)
You could also check for the file or directory's existence before running
test -e $i && stat -c%s $i
Or use some combination of these techniques.