How To Delete Recycle Bin Windows 11

0 views
Skip to first unread message

Pang Murdock

unread,
Aug 4, 2024, 7:15:49 PM8/4/24
to riagrapwencha
Asfar as I can tell, these is no "official" Microsoft supported way of doing this. There are two options. One involves deleting c:\$Recycle.Bin and the other is scripting cleanmgr.exe to run at each user logon.

If you want this to happen immediately, it seems that you can just run rd /s c:\$Recycle.Bin and Windows should re-create the necessary folders the next time that they are needed. I just tested this quickly and it appears to work, but -obviously- proceed with caution.


You can do this with the Disk Cleanup tool (cleanmgr.exe). Unfortunately, Microsoft decided to bundle this with the "Desktop Experience" set of features, meaning you'll have to install a bunch of other crap and reboot.


Running cleanmgr alone won't let you clear everyone's recycle bin, but you can use /sageset and /sagerun to make a logon script that runs for all users via GPO that will clear their recycle bin on the next logon, as described here. It's not the cleanest thing, but it will work. The linked article is for XP, but the syntax is unchanged as of Server 2008 R2.


I don't think there is a proper way documented as the recycle bins for users are kept separate in their profiles; this would also be a security hazard to allow because documents or items in the recycle bin, if perused by users, could allow certain documents to be leaked.


It might be possible to script an administrator-privileged script to run and clear files from the trash of each local profile (but that might still be synced to the server holding your profiles if you have roaming profiles). But you need to have permissions and ownership properly set; I know on our servers Administrator does not have proper access to profiles on the storage server; administrator has to take ownership of the profile, and when we're done return ownership to the proper user or else profiles don't work properly for them anymore.


You could try running a process at logoff that clears the trash directory per user, but that also entails accidentally deleting something that they want to recover later and will now be gone since it was deleted at last logoff.


Probably the "proper" way to do it is to configure quotas on workstations and servers and when that quota is hit for storage, the user learns they have to delete items from the recycle bin. Because of security it would be a training issue. Otherwise you'd need a workaround.


@markm had a utility suggestion that appears to do this; I stand by the assertion that it's not a "proper" way since it's an add-on and not built into Windows by default (although I'm not surprised that the helpful administration utility isn't included.) The only other problem I'd worry about in using it is that it might have to be run on a workstation and on the server or you might have profile syncing issues with what appears where. It looks like it's supposed to be just a mini-tool for accessing the "disk cleanup" tab in Windows.


Another thought...untested...would be to use folder redirection to redirect their trash folder to a central server. I would classify this as a monumentally Bad Idea(tm), however. Then you'd delete their files from that shared directory. Linking this over the network, security setup, etc. would make this a level one priority kludge that would make other sysadmins run away before spontaneously combusting, however.


I ran TreeSize Free and saw I had 15gigs in the Recycle Bin, but I couldn't see it, probably because it was done by a long departed user. But in TreeSize Pro I could delete it, which put the data into the Recycle Bin that I could see.


Might no be the most elegant code and there may well be a better way to do it but it will help free up space on a congested server. You can test it using the -WhatIf switch on the Remove-Item command.


I had a recycle bin that was showing over 4GB of data but I was unable to clear it. Went in and found a bunch of profiles that were no longer used on the server and removed them under system properties - Advanced - User Profiles and now the recycle bin is empty.


I liked this solution because is easy to understand what it is doing and it does the job, but in order to work from any location you run the command from, you need to run change it like this (adding a \ after the "drive_letter:") and to be able to delete those folder from other users.. you need to add the "-force" at the end of the remove-item command. Additionally as you are deleting all folders within C:\$Recycle.bin\ you do not need to include "-recurse" when getting the child items. So this will be the final command i would use instead:


This may be related to a path of a file or folder in the Recycle Bin being longer than some limit. Some alternatives are suggested in this answer: (a) dealing with long file names using UNC \\.\... path notation and (b) using RoboCopy.


What was also useful is enabling Windows Explorer to show hidden system files and folders, like C:\$Recycle.Bin (may be called different on different systems, such as "Recycler"), by: pressing Alt to show the menu in Windows Explorer, Tools Folder Options, View tab, uncheck Hide protected operating system files (Recommended).


This trick has worked for me every time without fail. First turn on hidden files and folders. Next go to your System 32 Folder and Highlight the folder so you can see all folders and files within that Folder.


Next locate a file entitled "qedit.dll". First you will have to take ownership of that file so you can temporarily relocate it. Once relocated to a place where it will be unable to interact with the System32 Folder, go to your recycle bin and delete your files noting that this time Windows Explorer will not crash and will allow you to empty your recycle bin. Then simply relocate the "qedit.dll" file back to the System32 folder and your done.


The file may be either blocked by an anti-virus and in that case is considered in-use, therefore not eraseable, or, you have insufficient permissions to erase it, in which case you will have to assimilate permissions for recycler and then delete it.To do that:RightClickPropertiesSecurityEditAdd-here put your login user (must be administrator), give it full controlpress OK, OK.Then delete the recycler.


In Windows Explorer's Folder Options dialog, along with ensuring Show hidden files, folders, and drives is selected, you need to ensure the Hide protected operating system files option is not selected.


The $RECYCLE.BIN directory can be deleted from Windows command line rmdir /q /s C:\$RECYCLE.BIN as described in the first answer to this similar question, although as a system virtual folder care should be taken. Also, it will get recreated upon deletion of files from the drive containing it.


When your external hard-drive is plugged in to your computer, you should be able to find the recycle bin on this external drive in windows explorer. Right click on it and emtpy recycle bin (as far as I remember, I have no windows right now).


Bounty - I'm starting a bounty. The files are still in my bin, as there was no pressing need to get rid of them and this way, I can try out the suggestions presented. I am, however, looking for a way that does not include hard-deleting the contents of the RECYCLER folder - I'm sure that would work, but it feels a bit unclean to me.


I have noticed that Windows 7 handles the Recycle Bin much worse than XP did, particularly when there are a lot of items in it. Whenever I have a bin filled with a ridiculous number of files, and especially when in 7, what I do is to open a command-prompt (cmd), and use a simple command to delete the Recycle Bin at the file-system level (change the drive as necessary):


Emptying the recycle bin is what actually deletes the files on file system level, so if that is taking long time, I don't think there's much you can do to it. You can try to minimize the disk usage by other programs, because unnecessarily seeking back and forth slows everything down, but that's about it.


The maximum capacity of the recycle bin is limited to certain percentage of the disk, so emptying it should never take hours. It does not help right now, but you might want to make sure your disk is defragmented at least weekly, if not daily. In Windows 7 you can schedule the defragmentation this way.


The only reasons I can think why emptying would take hours is having lots of very small files on very fragmented disk, or some program interfering with the process. Or disk/cable having problems causing lots of retries on IO operations.


File system is the part of operating system that keeps track of files and directories, and where they reside on the blocks of the storage device. If you have a directory of hundred thousand files, file system needs to have entry for each of them, to make browsing and accessing the directory reasonably fast, to know where the data of those files is stored on device blocks, and to know who is allowed to access them. Every time a file is added or removed, all this data needs to be updated, so that we know that some parts of the storage device are now free for others to use.


This almost always indicates something's corrupted in the Recycle Bin, which causes CCleaner not to be able to clean it out. However, in most situations, this problem can be quite simply resolved by resetting the Recycle Bin.


If all goes well, you should not receive a status message back from the Command Prompt, just an empty line down and another prompt, as shown in the attached image. If you do receive a message, that means something's gone wrong (most commonly a typo - easy enough to do!) so simply try again.


I recently discovered that if you turn off "empty recycle bin" in the custom cleanup settings, then the "Run CCleaner" option on the recycle bin does nothing. I turned this off in the custom clean because it didn't say "securely delete files in the recycle bin" and thought I should leave them there to run when I select the option on the recycle bin itself. After turning this item back on in the custom settings, I closed CCleaner and selected to run it from the context menu of the recycle bin and it worked again as expected.

3a8082e126
Reply all
Reply to author
Forward
0 new messages