recycle-bin

How can I empty the recycle bin for all users from a Windows service application in c#

I'm looking for a c# snippet which I can insert in a Windows service. The code must empty the recycle bin for all users on the computer. I have previously tried using SHEmptyRecycleBin (ref http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx) however the code doesn't work when ran from a windows service as the service is running wit...

How can I get the localized name of a 'special' windows folder (Recycle bin etc.)?

I'm trying to find out the 'correct' windows API for finding out the localized name of 'special' folders, specifically the Recycle Bin. I want to be able to prompt the user with a suitably localized dialog box asking them if they want to send files to the recycle bin or delete them directly. I've found lots on the internet (and on Stack...

How can I tell that a directory is really a recycle bin?

I need a function that, given a path, tells me whether it is a Recycle Bin folder. I tried using functions like SHGetSpecialFolderPath with CSIDL_BITBUCKET, but that doesn't work because the Recycle Bin is a virtual folder that is the union of the Recycle Bins of all drives. This question is to document a response posted in http://blo...

Is it possible with Java to delete to the Recycle Bin?

Java is the key here. I need to be able to delete files but users expect to be able to "undelete" from the recycle bin. As far as I can tell this isn't possible. Anyone know otherwise? ...

How to detect the item restore on a ItemAdded() event on SharePoint

Hi, I know that when an item is restored from the recycle bin, the ItemAdded event is fired. However, how can i detect if the item added comes from the recycle bin or if it is a new file. Thanks ...

How does Vista Recycle bin work?

I am trying to write a python module to move files to the 'Recycle Bin' on both Mac and PC. Is there a way, only from the commandline (and yes, I mean using absloutly no C#/C++/etc) to move a file into the Recycle Bin, and have it appear as a file trashed by drag and drop (or deleted via SHFileOperation, etc). ...

Vista Recycle Bin Maximum Size

Does anyone know how to set the Maximum Size of the Recycle Bin via script? Whether its written in batch or vbs or just a reg file? I've been exploring this idea for the last few days, and can't get an answer. Maybe someone here knows how. I'm wanting to add it to my Vista Cleanup Script =) ...

Listing files in recycle bin

Hi guys me again :) 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-...

How to Move files to the recycle bin

Hi, I need to Move a file to recycle bin in .net 2003 I added microsft.visualbasic.runtime dll from refrence, but i could not able to get filesystem.deletedirectory, So what to do..Can any one help me? ...

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

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

Finding the Recycle Bin on a local NTFS drive

I'm trying to write some simple code that will return the directory for the recycle bin on a local drive. Seems like it would be simple -- should be a thousand answers on Google. Haven't found one yet :( I HAVE found that FAT and NTFS drives have different base names (RECYCLED and RECYCLER). I've found that 'the' recycle bin is a vir...

Deleting a single item FROM recycle bin

Hi, is there anyway in C# (interop maybe) to delete a specific file in the recycle bin permanently? While searching on the internet I only found ways to delete TO the recycle bin not FROM. I also don't want to empty the whole bin, just one specific file. The specific item is already in the recycle bin. How can I do this? EDIT: I di...

How to delete folder into recycle bin in C++

I am programing under C++, MFC, windows. I want to delete a folder into recycle bin. How can I do this? CString filePath = directorytoBeDeletePath; TCHAR ToBuf[MAX_PATH + 10]; TCHAR FromBuf[MAX_PATH + 10]; ZeroMemory(ToBuf, sizeof(ToBuf)); ZeroMemory(FromBuf, sizeof(FromBuf)); lstrcpy(FromBuf, filePath); SHFILEOPSTRUCT FileOp;...

Add an entry to recycle bin right click menu using C#

I'm looking for a C# code to add my own entry to recycle bin right click menu. I've already seen this. What should i do to represent recycle bin.(Sample is provided for jpeg files) ...

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

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

How can I quickly iterate over all files except except for recycled ones?

Followup to this question. I'd like to get a list of all files, except for files that are currently in a recycle bin. I am able to use FileAttributes to check for hidden/system files and whatever kind of weirdness the file system provides, but the only way to check for recycled files quickly seems to be a comparison with ".:\$RECYCLE.*"...

How can I tell that a directory is the Recycling bin in VB6?

I am attempting to port the code in this article to VB6, but I'm experiencing crashing. I'm pretty sure my error is in my call to SHBindToParent (MSDN entry) since SHParseDisplayName is returning 0 (S_OK) and ppidl is being set. I admit my mechanism of setting the riid (I used an equivalent type, a UUID) is pretty ugly, but I think it ...

How to delete to recycle bin in FinalBuilder

I'm finding that deleting a folder containing many files and subfolders in FinalBuilder is very slow. An an alternative, I could delete the folder to the recycle bin. Anyone have any suggestions how to do this in FinalBuilder 5? ...

What does ShFileOperation do when the recycle bin is full?

I use this procedure: function MoveToRecycle(sFileName: widestring): Boolean; var fos: TSHFileOpStructW; begin FillChar(fos, SizeOf(fos), 0); with fos do begin wnd := 0; wFunc := FO_DELETE; pFrom := PWideChar(sFileName + #0 + #0); pTo := #0 + #0; fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or FOF_NOCONFIRMATIO...

Deleting file to recycle bin on Windows x64 in C#

I've got this class which seems to work quite well on non-64bit. using System; using System.Runtime.InteropServices; namespace DeleteToRecycleBin { /// <summary> /// Send files directly to the recycle bin. /// </summary> public class RecybleBin { /// <summary> /// Possible flags for the SHFileOperation method. /// </summar...