how to identify hidden files in linux?

Alex

Diamond Member
Oct 26, 1999
6,995
0
0
i know they have a '.' before their name but isnt tehre a variable that LSTAT sets when its a hidden file? like with the followign code:

lstat(filename, &statbuf);
if(S_ISREG(statbuf.st_mode) this tests for regular files... and it finds hidden files too... wtf....

any help appreciated!
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
No, it's not a special attribute of any kind, it's just customary to normally hide files that start with a period.
 

Alex

Diamond Member
Oct 26, 1999
6,995
0
0
Originally posted by: BingBongWongFooey
No, it's not a special attribute of any kind, it's just customary to normally hide files that start with a period.

so the only way to identify them is to find out whether the first char is a '.' then?

weak! :(
 

Alex

Diamond Member
Oct 26, 1999
6,995
0
0
Originally posted by: notfred
It's hardly difficult to see if the first character is a '.'.

i know its trivial i was just disappointed that there wasnt such functionality in lstat...
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Originally posted by: franguinho
Originally posted by: notfred
It's hardly difficult to see if the first character is a '.'.

i know its trivial i was just disappointed that there wasnt such functionality in lstat...

As BBWF said, there IS no such thing as a hidden file in linux (or most variants of unix). It's just a convention that you hide files starting with ".".