SORRY FOR MY BAD ENGLISH I searched for code thats not show the files which invisible on 'windows explorer' but visible on 'os.listdir(path)', and I have got this code:
if os.name == 'nt':
import win32api, win32con
def folder_is_hidden(p):
if os.name== 'nt':
attribute = win32api.GetFileAttributes(p)
return attribute & (win32con.FILE_ATTRIBUTE_HIDDEN | win32con.FILE_ATTRIBUTE_SYSTEM)
else:
return p.startswith('.') #linux-osx
print folder_is_hidden('path')
I understood that the return value is True if its invisible and False if isnt. But - I want to understand exactly how it works.
I want to understand this code and its purpose line by line.