How to tell if a folder/file is hidden or not?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Sakesaru
Forum Newbie
Posts: 3
Joined: Fri Sep 22, 2006 12:08 am
Location: New Zealand

How to tell if a folder/file is hidden or not?

Post by Sakesaru »

How can I tell if a file/folder is hidden or not? I don't want to show hidden files or folders in an app I've been working on.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

In Windows, I don't think that hidden files are exposed to PHP unless Windows has been set to display hidden files and folders. If they are, I don't know that PHP has any way of determining whether or not a file/folder is hidden.
User avatar
Sakesaru
Forum Newbie
Posts: 3
Joined: Fri Sep 22, 2006 12:08 am
Location: New Zealand

Post by Sakesaru »

It seems they are exposed, setting explorer to show/hide hidden files doesn't make any difference. They still show up.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

I wasn't thinking -- a file's hidden property doesn't belong to the file system, but to windows explorer. You could always do some research and hack into the registry via PHP's file API if that's where the property resides (not worth your time, and probably not possible). What you should do is put giant DELETE links next to /windows and /windows32 in your program -- that would solve a lot of problems.
User avatar
Sakesaru
Forum Newbie
Posts: 3
Joined: Fri Sep 22, 2006 12:08 am
Location: New Zealand

Post by Sakesaru »

the app gives me/others from the household access to there home "my documents", cant get to win folders or anything else.

i just decided to have it block echo'ing stupid folders like save games, would have been more conveient for the future if it doesnt show hidden folders in the output. ill just have to hard code it in future. thanks anyway :)
Post Reply