0

In python, is there a way to check for file attributes to filter out hidden files in windows? I know in Linux, checking for a leading '.' can do the trick but it does not work in windows. I would like to do this without having to use the win32 api. The code should only list files/directories without the hidden attribute.

pathnow = "C:/"

for f in os.listdir(pathnow):
    print f
  • I truly believe that this question MUST have been answered before. Have you tried googling before asking the question? – RedX Apr 02 '14 at 14:07
  • 1
    possible duplicate of [How to ignore hidden files using os.listdir()? - Python](http://stackoverflow.com/questions/7099290/how-to-ignore-hidden-files-using-os-listdir-python) – falsetru Apr 02 '14 at 14:07
  • @falsetru like i said, i did not want to use the win32api. Anyways, i think i was looking for ctypes.windll.kernel32.GetFileAttributesW(unicode(pathnow)) maybe i can get results from this somehow and filter out the list – user3489684 Apr 02 '14 at 14:36

0 Answers0