D
D
dospayne22019-07-18 15:11:24
Python
dospayne2, 2019-07-18 15:11:24

How to hide a folder using Python in Windows family OS?

How to hide a folder using Python in Windows family OS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2019-07-18
@dospayne2

import win32con, win32api,os

file='test'
f=open('test','w')
f.close()

#make the file hidden
win32api.SetFileAttributes(file,win32con.FILE_ATTRIBUTE_HIDDEN)

#make the file read only
win32api.SetFileAttributes(file,win32con.FILE_ATTRIBUTE_READONLY)

#to force deletion of a file set it to normal
win32api.SetFileAttributes(file, win32con.FILE_ATTRIBUTE_NORMAL)
os.remove(file)

Tynts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question