如何使用FileSystemWatcher获取已删除的文件/文件夹 [英] How to Get the deleted File/Folders using FileSystemWatcher

查看:120
本文介绍了如何使用FileSystemWatcher获取已删除的文件/文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户删除根文件夹,如何获取已删除文件的完整列表:

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

例如:c:\ A \ B \ C \ D \ F \ read.txt

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

如果用户删除根文件夹A,则需要将文件/文件夹重新分配到A,为此,C#中是否有任何API?

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?

我们可以使用根文件夹路径并从RecycleBin中检索相关文件吗? 我不知道用户是否单击Shift + Delete,如何从RecyleBIn获取它

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

推荐答案

没有没有API可以告诉您哪些文件已被删除.您可以 列出回收站的内容,但不能保证它是准确的(由于您在问题中描述的原因: Shift + Delete ).

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).

在任何时间都无法维护现有文件列表或使用FileSystemWatcher(或者可能是OS筛选器驱动程序)监视磁盘更改的时间短,我认为您不走运.

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?

这篇关于如何使用FileSystemWatcher获取已删除的文件/文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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