czkawka
czkawka copied to clipboard
Permission error deleting files using GUI on Windows 10
Hello, I just started using Czkawka. While the search for duplicates feature works well, I am unable to delete the files, as I get the following error:
'Failed to delete file [File Path Name], reason Access is denied. (os error 5)'
I have tried running the GUI as an administrator, but this hasn't yielded results. Does anyone know why this might be happening / a potential fix?
I can confirm this issue on Windows 11.
i have the same issue
This maybe not czkawka's fault, I found that the files I copied from other device have been set "read only" attribution automatically. The "read only" file can be deleted by explorer.exe only, but not other script or programs.
- check out whether your account have the permission to modify the files
- check out whether the file has "read only" attribution
Maybe the Windows system tools icacls.exe
and attrib.exe
are useful.
I have python code to change the premission into absolute control. Then you can delete the files in your path.
from pathlib import Path
import os
def set_full_control_permissions(path):
path = Path(path)
# 遍历路径下所有文件
for file_path in path.glob('**/*'):
# 仅处理文件,不处理文件夹
if file_path.is_file():
# 获取文件的绝对路径
absolute_path = file_path.resolve()
# 获取文件的属性
file_attributes = os.stat(absolute_path)
# 将文件的属性设置为 read-write/executable
os.chmod(absolute_path, file_attributes.st_mode | 0o777)
# 使用示例
set_full_control_permissions('D:\\documents\\Wechat\\WeChat Files')