Skip to content

Instantly share code, notes, and snippets.

@cbwar
Created April 5, 2017 12:17
Show Gist options
  • Save cbwar/acdea76b795a2e0bb29a475e7cbc2129 to your computer and use it in GitHub Desktop.
Save cbwar/acdea76b795a2e0bb29a475e7cbc2129 to your computer and use it in GitHub Desktop.
Python: Set directory as hidden on windows
def path_set_hidden(path):
"""
Hide a path on windows system (set hidden tag)
:type path: string
:param path: path to hide
:return: bool
"""
if not os.path.exists(path):
return False
import ctypes
ret = ctypes.windll.kernel32.SetFileAttributesW(path,
FILE_ATTRIBUTE_HIDDEN)
if not ret:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment