如何将shred实用程序添加到 Dolphin (Linux Mint 18 KDE) 的上下文菜单中以删除文件和文件夹?
问问题
654 次
2 回答
1
- 使用以下内容创建文件
shred.desktop
:
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/allfiles;
Actions=Shred
#X-KDE-Submenu=Shred
[Desktop Action Shred]
Name=Safe Remove
Name[ru]=Удалить навсегда
Icon=trash-empty
Exec=shred -u -f -z -n3 %u
- 使用以下内容创建文件
shred_folder.desktop
:
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=Shred
#X-KDE-Submenu=Shred
[Desktop Action Shred]
Name=Safe Folder Remove
Name[ru]=Удалить папку навсегда
Icon=trash-empty
Exec=find %u -type f -exec shred -u -f -z -n3 {} \;
#Exec=find %u -type f -exec notify-send {} '' \;
- 把这些文件放在这里:(
/usr/share/kservices5/ServiceMenus/
如何找到这个路径?) - 重新启动(或重新启动会话)
结果:
附加信息:
MimeType
对于文件是all/allfiles
,对于文件夹是inode/directory
- 使用的碎纸选项:
-u - After shredding a file, deallocate it (if possible) and then remove it.
-f - Change permissions to allow writing if necessary.
-z - Add a final overwrite with zeros to hide shredding.
-n3 - Use 3 passes of overwriting.
%u - The file path for removing.
- 删除带有碎片的文件夹的细节:https ://unix.stackexchange.com/a/27029/330017
- 以下是有关创建上下文菜单条目的更多信息:KDE 文档
于 2019-12-17T12:48:49.130 回答
1
这是一个稍有改动的版本,它实现了一个确认对话框和一个更合适的图标(恕我直言)
- 文件
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/allfiles;
Actions=Shred
#X-KDE-Submenu=Shred
[Desktop Action Shred]
Name=Safe Remove
Icon=edit-delete-shred
Exec=/bin/bash -c 'kdialog --title "Safe Delete" --warningcontinuecancel "Safe Delete: Are you sure?" && shred -u -f -z -n3 %u'
- 目录
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=Shred
#X-KDE-Submenu=Shred
[Desktop Action Shred]
Name=Safe Folder Remove
Icon=edit-delete-shred
Exec=/bin/bash -c 'kdialog --title "Safe Delete" --warningcontinuecancel "Safe Delete: Are you sure?" && find %u -type f -exec shred -u -f -z -n3 {} \; && rmdir %u'
于 2021-09-05T23:57:08.067 回答