recycle-bin

How to restore files from recycle bin [duplicate]

心不动则不痛 提交于 2019-12-19 09:07:07
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How do I restore a file from the recycle bin using C#? Someone knows how to restore files from recycle bin using C# with the Windows API?. 回答1: This link can help you using System; using System.Collections; using System.Windows.Forms; using System.IO; using Shell32; //Reference Microsoft Shell Controls And Automation on the COM tab. using System.Runtime.InteropServices; using Microsoft.VisualBasic.FileIO;

Listing files in recycle bin

北城以北 提交于 2019-12-18 12:35:15
问题 I'm wanting to list the files that are in the recycle bin in Vista from the command line. So far I have this.. dir C:\$Recycle.Bin /s /b >> recyclebin.txt That does alright, the output I get is this.. C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$I2H8K48.zip C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IE94UAG.exe C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$IR4P99W.rar C:\$Recycle.bin\S-1-5-21-931442927-344369455-2477061601-1000\$R2H8K48.zip

How can I tell that a directory is the recycle bin in C#?

我们两清 提交于 2019-12-18 04:02:06
问题 Given a folder, how can I tell that it is a recycle bin? I've found an answer for C++ but not for C#. My first idea was to check for FileAttributes.System (which would be an acceptable approximation in my case) but actually that flag is cleared on the recycle folder. Crude solutions using hardcoded folder names are out of the question (we're in 2009 after all). 回答1: There's a little problem here. The Windows Recycle Bin is a virtual folder and does not actually exist. The files that you see

How can I tell that a directory is the recycle bin in C#?

本秂侑毒 提交于 2019-12-18 04:01:53
问题 Given a folder, how can I tell that it is a recycle bin? I've found an answer for C++ but not for C#. My first idea was to check for FileAttributes.System (which would be an acceptable approximation in my case) but actually that flag is cleared on the recycle folder. Crude solutions using hardcoded folder names are out of the question (we're in 2009 after all). 回答1: There's a little problem here. The Windows Recycle Bin is a virtual folder and does not actually exist. The files that you see

How do I restore a file from the recycle bin using C#?

一笑奈何 提交于 2019-12-17 09:58:44
问题 Moving files to the recycle bin and emptying the recycle bin are well documented, but how can a file be programmatically restored from the recycle bin? 回答1: There seems not to be a solution in pure C#. You most likely have to resort to P/Invoke. This article presents a solution in C++ using the SHFileOperation API. 回答2: The only other reference to this beyond the previously mentioned link to codeproject that I can see mentions this: Call SHGetFolderLocation passing CSIDL_BITBUCKET. Then you

Send a File to the Recycle Bin

穿精又带淫゛_ 提交于 2019-12-17 04:44:17
问题 Currently I'm using the following function file.Delete(); But how can I use this function to send a file to the recycle bin instead of just deleting it outright? 回答1: NOTE: This also does not work with non UI Interactive apps like Windows Services This wrapper can provide you needed functionality: using System.Runtime.InteropServices; public class FileOperationAPIWrapper { /// <summary> /// Possible flags for the SHFileOperation method. /// </summary> [Flags] public enum FileOperationFlags :

How to Invoke a Verb on a ShellFile/ShellFolder/ShellObject objects using Windows API Code Pack?

拜拜、爱过 提交于 2019-12-13 08:07:02
问题 I'm looking for a C# or Vb.NET solution to know how I can invoke the undelete verb on a ShellObject ( ShellFile or ShellFolder ) stored in the recycle bin. The recycle bin part I've it written, what I only need is to know how to invoke a verb on a deleted item. To understand me better I'll show this example of how I invoke a verb using the Shell32 Interface, but I can't find any similar method on the ShellObject/ShellFile/ShellFolder items of the Windows API Code Pack library where I'm

When does Hadoop Framework creates a checkpoint (expunge) to its “current” directory in trash?

穿精又带淫゛_ 提交于 2019-12-11 01:45:04
问题 From a long time, I have observed that Hadoop framework set a checkpoint on the trash current directory irrespective of a time interval whereas permanently deletes the file/directory within the specified deletion interval after creating the automatic checkpoint. Here is what, I have tested: vi core-site.xml <property> <name>fs.trash.interval</name> <value>5</value> </property> hdfs dfs -put LICENSE.txt / hdfs dfs -rm /LICENSE.txt fs.TrashPolicyDefault: Namenode trash configuration: Deletion

Clear Recycle Bin programmatically with Powershell

╄→尐↘猪︶ㄣ 提交于 2019-12-10 09:34:01
问题 One of the hardest things I've had to do is access Windows APIs with PowerShell. I want to erase the Recycle Bin using the API in Shell32.dll. There are other ways of doing it, but they are typically bypassing the normal Windows processes and in this case, I want to do it the "right" way. 回答1: After a few hours, I came up with this. $TypeDefinition=@" using System; using System.ComponentModel; using System.Runtime.InteropServices; namespace shell32 { //Put all the variables required for the

Does Java 7 have a way to put files in recycle bin rather than delete on Windows

半腔热情 提交于 2019-12-08 16:33:13
问题 Does Java 7 have a way to put files in recycle bin rather than delete on WIndows ? I know it doesn't exist in Java 6, but I really thought this was getting added to Java 7 but have been unable to find it, if not is there a 3rd party library available to do this, I don't want to fiddle with JNI myself. FWIW you can do this on OSX using the Apple extension com.apple.eawt.FileManager.moveToTrash() EDIT: Used the jna library as in answer. FWIW it is available on maven central repository, but you