recycle-bin

Finding the Recycle Bin on a local NTFS drive

坚强是说给别人听的谎言 提交于 2019-11-30 16:23:29
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 virtual folder that combines the recycle bins of all drives on the machine. What I haven't found is a way to find C: drive's recycle bin directory -- even on a Vietnamese (or any other non-English) machine. (No posts I can find indicate whether "RECYCLER" gets

Finding the Recycle Bin on a local NTFS drive

匆匆过客 提交于 2019-11-30 16:06:16
问题 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 virtual folder that combines the recycle bins of all drives on the machine. What I haven't found is a way to find C: drive's recycle bin directory -- even on a

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

时光总嘲笑我的痴心妄想 提交于 2019-11-29 03:45:26
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). There's a little problem here. The Windows Recycle Bin is a virtual folder and does not actually exist. The files that you see are not actually in that folder, they are the representation of existing files on disk that have been renamed

how to empty recyclebin through command prompt?

纵饮孤独 提交于 2019-11-27 17:09:23
Usually we delete the recycle bin contents by right-clicking it with the mouse and selecting "Empty Recycle Bin". But I have a requirement where I need to delete the recycle bin contents using the command prompt. Is this possible? If so, how can I achieve it? You can effectively "empty" the Recycle Bin from the command line by permanently deleting the Recycle Bin directory on the drive that contains the system files. (In most cases, this will be the C: drive, but you shouldn't hardcode that value because it won't always be true. Instead, use the %systemdrive% environment variable.) The reason

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

爱⌒轻易说出口 提交于 2019-11-27 09:41:10
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? 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. 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 can manipulate that folder as usual. You'll have to create an interop for the SHGetFolderLocation function. "CSIDL

How to “safely” delete folder into Recycle Bin

孤人 提交于 2019-11-27 06:00:42
问题 I'm looking for a way to put a folder (with subfolders) into a Recycle Bin with these conditions: It must be done silently -- without any Windows UI. The folder must never be permanently deleted. If it can't be put into Recycle Bin, I'd expect the API to fail. Get a callback routine for the process like CopyFileEx does. So far I was able to come up with this: SHFILEOPSTRUCT sfo = {0}; sfo.wFunc = FO_DELETE; sfo.pFrom = L"K:\\test del from USB\0"; //Folder on a USB stick sfo.fFlags = FOF

how to empty recyclebin through command prompt?

拥有回忆 提交于 2019-11-26 18:53:23
问题 Usually we delete the recycle bin contents by right-clicking it with the mouse and selecting "Empty Recycle Bin". But I have a requirement where I need to delete the recycle bin contents using the command prompt. Is this possible? If so, how can I achieve it? 回答1: You can effectively "empty" the Recycle Bin from the command line by permanently deleting the Recycle Bin directory on the drive that contains the system files. (In most cases, this will be the C: drive, but you shouldn't hardcode