I am working on some project.
I want that I lock some file whenever I run the script.
So that noone can delete/modify the file.
I am working on some project.
I want that I lock some file whenever I run the script.
So that noone can delete/modify the file.
Use os module for this purpose.
import os
file_path = 'D:\\file.txt' # your file path
os.system(f'echo y| cacls {file_path} /P everyone:n')
I hope you got it.