删除文件夹内容,如果有人打开它 [英] delete folder content if someone open it

查看:116
本文介绍了删除文件夹内容,如果有人打开它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使一个文件夹的内容安全

所以我的目标是建立批处理文件或小程序,可以删除该文件夹中的所有内容,如果有人打开或复制它。 />


无限制技术或编程技术或语言。

使用C#,Java,C ++,批处理文件或其他方式非常重要
所以任何脚本或想法都会受到赞赏。



谢谢..

I am trying to Make Content Of One Folder Secured
So My Goal Is to build batch file or small program that can delete all content in that Folder If Some One Open Or Copy It.

No Limitation In Technologies or programming techiques or languages.
USING C# , Java, C++, Batch-Files or other ways dosent matter
So Any Scripts Or Ideas Will be Appreciated .

Thanks..

推荐答案

阅读完评论后,问题应该更新。



这个答案是针对Windows的。



您可以创建具有独占读取和独占写入权限的临时文件,并在应用程序关闭时设置要删除的文件。



查看此链接:

http://msdn.microsoft。 COM / EN-US /库/窗/台式机/ aa363858%28V = vs.85% 29.aspx [ ^ ]



使用零作为共享模式(不包括)。包含标志参数的FILE_FLAG_DELETE_ON_CLOSE。



在应用程序运行时保持文件处于打开状态。在关闭文件之前,擦除文件内容。



这不是100%,但涵盖了大多数情况。如果在文件存在时设备断电,则数据仍然存在。



一个更好的解决方案(虽然不是你原来的问题)只是解密所需的部分并将它们保留在内存中。
After reading through the comments, the question should be updated.

This answer is Windows specific.

You can create a temporary file with exclusive read and exclusive write access AND set the file to be deleted when closed by your application.

See this link:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx[^]

Use zero for share mode (exclusive). Include FILE_FLAG_DELETE_ON_CLOSE for the flags parameter.

Leave the file open while your application is running. Just before you close the file, wipe the file contents.

This isn't 100% but covers most cases. If the device is powered off while the file exists, the data is still there.

A better solution (though not your original question) would be to decrypt only the portions needed and retain them in memory.


这篇关于删除文件夹内容,如果有人打开它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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