How to Get the deleted File/Folders using FileSystemWatcher

老子叫甜甜 提交于 2019-12-11 05:47:22

问题


How to get the complete list of deleted files if user delete the a root folder:

Ex: c:\A\B\C\D\F\read.txt

If user delete the root folder A, I need to get the files/folders realted to A, Is there any API in C# for this?

Can we get use the root folder path and retrieve the related files from teh RecycleBin? I dont't know if user clicks Shift + Delete, how we can get it from RecyleBIn


回答1:


No there isn't an API that will tell you which files have been deleted. You could list the contents of the Recycle Bin but it is not guaranteed to be accurate (because of the reason you describe in your question: Shift+Delete).

Short of maintaining a list of existing files at any point in time or monitoring disk changes with FileSystemWatcher (or possibly an OS filter driver), I think you're out of luck.

I am curious though, why would you want to?



来源:https://stackoverflow.com/questions/9628011/how-to-get-the-deleted-file-folders-using-filesystemwatcher

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!