Python win32con.FILE_ATTRIBUTE_HIDDEN Examples

The following are 9 code examples of win32con.FILE_ATTRIBUTE_HIDDEN(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module win32con , or try the search function .
Example #1
Source File: nt.py    From deplicate with MIT License 5 votes vote down vote up
def has_hidden_attribute(filename):
    try:
        st = lstat(filename)
        flag = bool(st.st_file_attributes & stat.FILE_ATTRIBUTE_HIDDEN)

    except AttributeError:
        attributes = win32api.GetFileAttributes(filename)
        flag = attributes & win32con.FILE_ATTRIBUTE_HIDDEN

    return flag 
Example #2
Source File: Lo0sR.py    From Lo0sR with MIT License 5 votes vote down vote up
def create_hidden_folder(self):
        if os.path.exists(path_to_files):
            pass
        else:
            os.makedirs(path_to_files)
            win32api.SetFileAttributes(path_to_files, win32con.FILE_ATTRIBUTE_HIDDEN) 
Example #3
Source File: directory.py    From king-phisher-plugins with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def path_is_hidden(self, path):
		if its.on_windows:
			attribute = win32api.GetFileAttributes(path)
			if attribute & (win32con.FILE_ATTRIBUTE_HIDDEN | win32con.FILE_ATTRIBUTE_SYSTEM):
				return True
		elif self.path_mod.basename(path).startswith('.'):
			return True
		return False 
Example #4
Source File: preference_manager.py    From ctSESAM-python-memorizing with GNU General Public License v3.0 5 votes vote down vote up
def set_hidden(self):
        """
        Hides the settings file if possible.
        """
        try:
            import win32con
            import win32api
            win32api.SetFileAttributes(self.settings_file, win32con.FILE_ATTRIBUTE_HIDDEN)
        except ImportError:
            pass 
Example #5
Source File: main.py    From MouseTracks with GNU General Public License v3.0 5 votes vote down vote up
def hide_file(file_name):
    """Set a file as hidden."""
    try:
        win32api.SetFileAttributes(file_name, win32con.FILE_ATTRIBUTE_HIDDEN)
    except win32api.error:
        return False
    return True 
Example #6
Source File: whipFTP_FileDialogs.py    From whipFTP with MIT License 5 votes vote down vote up
def folder_is_hidden(self, p):
        #See SO question: https://stackoverflow.com/questions/7099290/how-to-ignore-hidden-files-using-os-listdir
        if platform.system() is 'Windows':
            try:
                attribute = win32api.GetFileAttributes(p)
                return attribute & (win32con.FILE_ATTRIBUTE_HIDDEN | win32con.FILE_ATTRIBUTE_SYSTEM)
            except:
                return False
        else:
            return p.startswith('.') 
Example #7
Source File: 構建.py    From Librian with Mozilla Public License 2.0 5 votes vote down vote up
def 構建工程(工程路徑, 標題, 圖標=None):
    if 圖標:
        subprocess.Popen(f'{此處}\\構建用\\ResourceHacker.exe -open {此處}\\構建用\\沒有窗口的虛僞的exe.exe -save {標題}.exe -action addoverwrite -res {圖標} -mask ICONGROUP,1,0')
    else:
        os.system(f'copy {此處}\\構建用\\沒有窗口的虛僞的exe.exe {標題}.exe')

    if os.path.isfile(f'_{標題}.kuzu'):
        win32api.SetFileAttributes(f'_{標題}.kuzu', win32con.FILE_ATTRIBUTE_NORMAL)
    with open(f'_{標題}.kuzu', 'w') as f:
        f.write(f'Librian.py --project "{工程路徑}"')
    win32api.SetFileAttributes(f'_{標題}.kuzu', win32con.FILE_ATTRIBUTE_HIDDEN) 
Example #8
Source File: treedisplays.py    From ExCo with GNU General Public License v3.0 5 votes vote down vote up
def _is_hidden_item(self, item):
        try:
            if data.platform == "Windows":
                # Windows
                attribute = win32api.GetFileAttributes(item)
                hidden = (
                    attribute & 
                    (win32con.FILE_ATTRIBUTE_HIDDEN | 
                        win32con.FILE_ATTRIBUTE_SYSTEM)
                )
            else:
                # Linux / OSX
                hidden = os.path.basename(item).startswith('.')
            return hidden
        except:
            return False 
Example #9
Source File: util.py    From bookhub with MIT License 5 votes vote down vote up
def is_hiden(filepath):
    if sys.platform.startswith('win'):  # windows
        return win32file.GetFileAttributes(filepath)\
            & win32con.FILE_ATTRIBUTE_HIDDEN
    else:  # linux
        return os.path.basename(filepath).startswith('.')