防止删除文件 [英] prevent delete file

查看:92
本文介绍了防止删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
如果我需要保护文件以免被删除,即使具有某些窗口文件之类的管理员权限,也是如此
那么我该如何在C#中做到这一点呢?
感谢all

hi every one .
if i need to protect file from been deleted even with administrator rights like some window''s files
so how can i do that in c# ???
thank to all

推荐答案

创建一个小型服务以使其始终保持打开状态-将文件共享设置为ReadWrite:

http://msdn.microsoft.com/en-us/library/f20d7x6t.aspx [ ^ ]

http://msdn.microsoft.com/en-us/library/system.io. fileshare.aspx [^ ]

不知道我会建议防止管理员通过...删除文件...

问候
Espen Harlinn
Create a small service to keep it open at all times - set file share to ReadWrite:

http://msdn.microsoft.com/en-us/library/f20d7x6t.aspx[^]

http://msdn.microsoft.com/en-us/library/system.io.fileshare.aspx[^]

Not sure I would advice preventing admin from deleting a file though ...

Regards
Espen Harlinn


看看Windows File Protection:
http://en.wikipedia.org/wiki/Windows_File_Protection [ http://support.microsoft.com/kb/222193/en-us [ ^ ]
您可以通过后台的服务来模仿这种行为,就像Espen所说的那样,如果文件被删除,则该文件将锁定文件或仅用备份覆盖文件.
Have a look at Windows File Protection:
http://en.wikipedia.org/wiki/Windows_File_Protection[^]
http://support.microsoft.com/kb/222193/en-us[^]
You could mimick that behaviour by a service in the background that, like Espen said, locks the file or just overwrites the file with a backup in case the file was deleted.


这篇关于防止删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆