Is there a way to recover file(s) that have been deleted programatically by the File.Delete() method?
Deleted files do not appear in the recycle bin.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
SHFileOperationAPI 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