是否可以使用Java删除回收站? [英] Is it possible with Java to delete to the Recycle Bin?
本文介绍了是否可以使用Java删除回收站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Java 是这里的关键。我需要能够删除文件,但用户希望能够从回收站中取消删除。据我所知,这是不可能的。有人知道吗?
Java is the key here. I need to be able to delete files but users expect to be able to "undelete" from the recycle bin. As far as I can tell this isn't possible. Anyone know otherwise?
推荐答案
出于各种原因,Windows 没有与回收站对应的文件夹概念。
For various reasons Windows has no concept of a folder that simply corresponds to the Recycle Bin.
正确的方法是使用JNI调用Windows SHFileOperation
API,在<$ c中设置 FO_DELETE
标志$ c> SHFILEOPSTRUCT 结构。
The correct way is to use JNI to invoke the Windows SHFileOperation
API, setting the FO_DELETE
flag in the SHFILEOPSTRUCT
structure.
- SHFileOperation文档
- 使用SHFileOperation复制文件的Java示例(同一篇文章中的回收站链接不起作用)
- SHFileOperation documention
- Java example for copying a file using SHFileOperation (the Recycle Bin link in the same article doesn't work)
这篇关于是否可以使用Java删除回收站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文