c# File.Delete recovery?

南楼画角 提交于 2019-12-04 03:42:46

问题


Is there a way to recover file(s) that have been deleted programatically by the File.Delete() method?

A program has deleted some files that I need to recover and they do not appear in the recycle bin.


回答1:


Nope. File.Delete() calls a hard delete within the API and by-passes the Recycle Bin. You will need to use a file recovery program and hope for the best.

For deletion via the Recycle Bin you use the SHFileOperation API as it is part of the shell.

If/once you have your files back you might want to take a look at this SO answer which discusses changing File.Delete() to something that uses the Recycle Bin:

Send a File to the Recycle Bin




回答2:


No, directly there is no way to recover it.

You can use a recovery program or API to get your files.

If the files are important I would shutdown the computer right away.

Take a look at this: C# classes to undelete files?

Same problem with answer.



来源:https://stackoverflow.com/questions/14200427/c-sharp-file-delete-recovery

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