You can use the same FileAccess API to check the information of folders too. At least on Linux.
FileAccess