- How To Delete a Folder Using Command Prompt of Windows
- 28 thoughts on “How To Delete a Folder Using Command Prompt of Windows”
- How to delete undeletable & locked files, folders in Windows 10
- Delete undeletable & locked files, folders
- 1] Reboot and try
- 2] Delete in Safe Mode
- 3] Run ChkDsk
- 4] Use CMD or PowerShell
- 5] File deleter software
- Related Posts
- Neat Download Manager for Windows 10 will speed up your downloads
- Best Free Ping Monitor Tools for Windows 10
- Best Free 8085 Microprocessor Simulators for Windows 10
- [email protected]
- Primary Sidebar
- How can I remove the home folder for a deleted user on windows 7?
- 3 Answers 3
- Not the answer you’re looking for? Browse other questions tagged windows-7 or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- 7 Tools To Find And Delete Empty Folders in Windows
- Delete Empty Folders Using a Third Party Program
- Delete Empty Folders From the Command Line or Scripts
How To Delete a Folder Using Command Prompt of Windows
To delete a folder using command prompt of windows, follow this procedure.
- Open a command prompt (Press the windows icon key and R to open the run window). Type cmd and hit enter from the keyboard.
- On a command prompt, enter the following command and hit enter from the keyboard.
When your path contains spaces, then the path must be enclosed in quotation marks.
28 thoughts on “How To Delete a Folder Using Command Prompt of Windows”
Thanks ! It worked for me !
100% spot-on – THNX
C:\Users\Marcel2>cd ..\..\Program Files
C:\Program Files>rmdir /s EqualizerAPO
EqualizerAPO, Are you sure (Y/N)? y
EqualizerAPO\EqualizerAPO.dll – Access is denied.
EqualizerAPO\libfftw3f-3.dll – Access is denied.
EqualizerAPO\libsndfile-1.dll – Access is denied.
EqualizerAPO\msvcp120.dll – Access is denied.
EqualizerAPO\msvcr120.dll – Access is denied.
Access is denied.
Try running the command from a console with administrative privileges.
open cmd as run as administrator
Right click and run command prompt as administrator
try running cmd as an administrator this will fix your problem
I followed your steps completely, yet I still get an error (“…” is in the place of sensitive information, my real name is the user, with a space in between):
C:\WINDOWS\system32>rmdir /s C:\Users\…\AppData\Local\Discord
C:\Users\…, Are you sure (Y/N)? Y
The system cannot find the file specified.
…\AppData\Local\Discord, Are you sure (Y/N)? Y
The system cannot find the path specified.
Does the folder really exist in that path?
how to set it automatically, it will delete folder for more than 2 days
C:\Program Files (x86)>rmdir /s Epic Games
Epic, Are you sure (Y/N)? y
The system cannot find the file specified.
Games, Are you sure (Y/N)? y
The system cannot find the file specified.
if you need to delete a folder that has spaces in the name then you need to encompass the full path in quotation marks “”, windows sees the space as a break in the command and thinks the next thing after it is another command, but by surrounding the full path in quotation marks “” it reads the full path within them, spaces included, so it should look like below
rmdir /s “c:\Program Files\folder name”
do c:\ first then run the command rmdir /s Epic Games
It will look like c:\ rmdir /s Epic Games
rmdir /s /q
The syntax of the command is incorrect.
What am i doing wrong
You have to specify the path of the folder that shall be deleted. Please see the tutorial above for examples.
The process cannot access the file because it is being used by another process.
Same it is not working for me. Windows 10
Stop the application that is using the file before you delete the file.
I chose “run as admin” and entered the prompt,
typed: rmdir /s E:\Lixo
still access denied
I’m trying to delete the “windows” folder from an old hd
any tips?
Cheers
Fail: cmd as admin, still “access denied”
Got same error saying access denied even after running the command with administrative privileges.
Yeah ! This command is running easily .
yes i did but not working
Thanks so much for your instructions. I had been to other sites, looking for instructions on how to delete a folder in the Command Prompt that I could not delete by right clicking and selecting delete. I kept getting “The system can not find the file specified.” or “The system can not find the path specified.” Your site was the only one which explained that you have to enclose the path in quotation marks, if there are any spaces. That was my problem. One of the folders in the path had a space in the title.
I ran the program both with command prompt and as a system administrator but it did not work yet. access denied
C:\Windows\system32>rmdir /s “C:\Users\USER\Downloads\messengerfordesktop-setup_0544956837.exe”
C:\Users\USER\Downloads\messengerfordesktop-setup_0544956837.exe, Are you sure (Y/N)? Y
Access is denied.
That example “My dumps”
Thanks helped me flush my dump :v
OMG! After searching for eons finding a way to delete some empty folders that apparently were an issue for windows I finally found your explanation on how to use this command in the CMD prompt!
It worked! Hallelujah! This old lady finally now knows how to remove folders that are more headstrong then myself! Thank you!
how to copy copy specific folder like
c:\user\admin\desktop (i want to compeletely copy desktop file not thoose file which is inside the desktop)
i use this cmd
xcopy c:\user\admin\desktop e:\data
(but not copy desktop. thoose file are coppied which is inside the desktop folder.)
How to delete undeletable & locked files, folders in Windows 10
If you are unable to delete undeletable, locked, ghost folders or files from Windows computer use CMD or a file deleter software to delete undeletable & locked files and folders in Windows 10/8/7.
At times you may find that you are just unable to delete a file or folder on your Windows computer. When you go to delete such ghost or undeletable files or folders you may get an Error message: Could not find this item.
Alternatively, you may also get the following messages:
- Cannot delete file: Access is denied
- There has been a sharing violation.
- The source or destination file may be in use.
- The file is in use by another program or user
- The file or directory is corrupted and unreadable.
- Make sure the disk is not full or write-protected and that the file is not currently in use.
Delete undeletable & locked files, folders
If you cannot delete files or folders in Windows 10 and then try these suggestions to delete the undeletable & locked files, folders:
- Reboot and try
- Delete in Safe Mode
- Run ChkDsk
- Use CMD or PowerShell
- Use File deleter software.
1] Reboot and try
First, reboot and see if you can delete it.
2] Delete in Safe Mode
Boot in Safe Mode and then try to delete it
3] Run ChkDsk
Run ChkDsk, and then see if you can delete it.
4] Use CMD or PowerShell
Use the del command to delete undeletable files:
Use the RMDIR or RD command to delete undeletable folders:
- /S : Delete all files and subfolders in addition to the folder itself. Use this to remove an entire folder tree.
- /Q : Quiet – do not display Y/N confirmation
Be very careful while using this method and use the correct commands.
5] File deleter software
If these methods fail, I suggest you download and use a free file deleter software to delete locked files and folders.
Free File Unlocker, Delete Doctor, Unlcoker, Tizer UnLocker, MoveOnBoot, Wise Force Deleter are some free file deleter software that can help you delete undeletable, hidden, ghost files and folders.
Unlocker unlocks the file or folder if it is being used by any other program and allows you to delete it. Its Explorer integration is a big help, as all you have to do is right on the undeletable folder or file and click on Unlocker.
If no locking handle is found, it will still delete the folder.
Unlocker is a handy tool to have around in such circumstances, BUT it comes with a pre-checked option of installing a QuickStores toolbar for eBay, Amazon & Shopping.com. It also places two eBay internet shortcuts on your desktop. You may want to uncheck these options.
Date: August 20, 2019 Tags: Folder, Freeware
Related Posts
Neat Download Manager for Windows 10 will speed up your downloads
Best Free Ping Monitor Tools for Windows 10
Best Free 8085 Microprocessor Simulators for Windows 10
[email protected]
Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.
Primary Sidebar
report this ad
How can I remove the home folder for a deleted user on windows 7?
I have deleted a user, but I was never prompted if I wanted to delete the home folder for this user. Now, when I try to delete the folder as another user in the administrator group, I get a message that I need permission from some ID string.
How can I delete this user’s home folder?
3 Answers 3
- In Control Panel → System click Advanced system settings.
- In the User Profiles group click Settings….
- Select the entry labeled «Account Unknown».
- Click Delete.
You can directly load the User Profiles dialog by running the following command:
You can also use WMI for deleting orphaned profile folders, e.g. via PowerShell:
You need to take ownership of the folder and it’s contents, and then delete it. If you right click on the user folder and go to the security settings, and then click advanced, you should see an ‘Owner’ tab. Selecting that will display the current owner as the GUID (random ID string) of the deleted user, and other accounts which can take ownership of the folder. Click the «Edit» button and select your user account, check ‘Repalce owner on subcontainers and objects», and then click apply. Once it is done, you should be able to delete the folder normally.
You could also try launching windows explorer as an administrator (Task Manager -> Show All Processes -> File, New Task (It should warn that the process will be created with administrative privileges), and then run explorer.exe . This should open a new explorer window running with full privileges. Be very, very careful. Try deleting the user folder with the Admin’d Explorer window. Close it immediately afterwards — it will let you mess up your system very quickly, and you don’t want to accidentally use it.
The other steps provided here did not work for me. Somehow while trying to follow some of these other steps I did something to remove the padlock icon that appears over the user folders. When I right clicked the user folder and selected delete most of the files were removed. But it still wouldn’t let me delete the folder because it said something like CurrentDatabase_372 for Windows Mediaplayer was still being used or was running or something like that. Doing Crtl+Alt+Del I couldn’t find the file on the Applications, Processes, or Services menus. I also did a system file search and that turned up nothing. I even tried unselecting the Read Only option when right clicking the user file, that didn’t work. Doing the same thing with the main User file didn’t work either.
Finally I got the bright idea to restart the laptop in Safe Mode by pressing and holding the F8 key before the Windows start screen. Booting in Safe Mode the file deleted quick and easy like any other file, then I emptied the trash to be sure it was gone. Reboot in normal mode and there is no trace of the file. Maybe it was user error that the other steps here didn’t work. But I still got’erdone!
Not the answer you’re looking for? Browse other questions tagged windows-7 or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
7 Tools To Find And Delete Empty Folders in Windows
Over time your Windows installation gets cluttered up with more and more data. While many of the files are important for the running of the system, some are useless and get left behind by software that has been uninstalled. The files and folders are therefore redundant but still on the system. As more and more is added to the operating system, it begins to slow down which is partly why an old install runs slower than a newer install.
Although folders by themselves don’t really cause any performance issues or take up any space, having thousands of folders spread across your system that don’t contain any files can become a bit of a pain. For the most part, they are of no practical use and just get in the way, especially while using Windows File Explorer. It’s frustrating to drill down through folders to find what’s in them only to discover they are completely empty and are serving no purpose.
Here we list 7 Windows based tools that can find and delete empty folders from your system. While many empty folders are of no use and can be safely deleted, others are required by software or Windows itself. It is never recommended to just mass delete all empty folders from your system drive and some experience is required to determine what is safe to remove and what isn’t. Don’t panic if you’ve made the wrong decision in deleting an important folder because there are free recovery software that you can use to restore back the deleted folder.
Delete Empty Folders Using a Third Party Program
Using a separate tool to delete a number of empty folders is going to be much faster and easier than trying to do it yourself manually. Here are some tools to look at.
1. Remove Empty Directories
Remove Empty Directories is probably the most well known empty folder deleting tool, but like many others, it hasn’t been updated in several years. The last update for this program was 2011. It still works great though, has enough functions for most users and manages to squeeze everything into a portable executable under 200KB in size.
After selecting and scanning the base folder or drive, the view will be populated with a tree view containing different colored text and icons. The icon list on the right will tell you if the folders are truly empty, contain trash files and are hidden, locked or can’t be read. Names in red are automatically marked for deletion. Right click on a red empty folder and select “Protect once” to ignore it for this session or “Add to ignore list” to permanently ignore the folder in future.
In the the Settings tab you can choose to delete to the Recycle bin or directly, skip predefined folders (7 are already added), add or remove what are classed as trash files (3 are pre entered), add a right click menu entry to Explorer, and set a few advanced options like recursive depth. Right click and run the program as administrator to enter Admin mode and allow deleting of protected folders.
2. EmptyFolderNuker
EmptyFolderNuker is probably the easiest GUI based empty folder remover here. It’s a bit old dating from 2007, and the official website is no longer there but the tool still works as intended, even in Windows 10. The program is also a single portable executable.
Browse for the folder or drive you want to check, then press the Find button. Make sure the two boxes are checked to scan the path recursively and treat folders as empty if they contain only empty folders. The Shell Integration box is useful and places a right click “Find empty folders” entry when you right click on a folder. The program will then open with the folder you clicked on as the base path.
You need to be slightly careful at the results window as all empty folders are pre-checked for deletion. It’s recommended to press Uncheck All and choose the folders selectively or go through the list and make sure to uncheck any folders you want to leave alone. After you press Delete, a UAC prompt will pop up if any folders require administrator privileges to remove.
3. Fast Empty Folder Finder
Like Empty Folder Nuker, this tool is quite old and its official website is no longer around. Fast Empty Folder Finder is a bit newer though and from 2011. The .NET Framework v2 is required so Windows 8 and 10 users will need to have the .NET 3.5 optional feature installed. Besides the .NET requirement, Fast Empty Folder Finder is portable.
When you press the Scan Locations button to add a folder, several different base folders can be added at once. This is useful and can stop the program scanning thousands of folders you are not interested in. After pressing Scan Now! select all the empty folders you want to remove using left click, Shift+click or Ctrl+click or use the List > Check menu options. Checked files can be deleted permanently or to the Recycle bin for a bit of added safety.
Although the lower pane Explorer window might be useful to check if a folder is really empty, it is mostly unneeded and can be turned off from the View menu. Empty folder lists can be exported to a text file for later use. One issue is Fast Empty Folder Finder doesn’t delete a folder if it only contains empty folders. If you have a path of foldera\folderb and both folders contain no files, only folderb will be deleted.
4. 4dots Empty Folder Cleaner
Empty Folder Cleaner by 4dots Software has both installer and portable versions available. The only major difference between the two is the installed version has the option to add a right click context menu entry so you can delete empty folders from the folder you right click on.
After selecting a drive or folder to scan and scanning it, you then have the opportunity to delete completely empty folders or those that contain what are considered “junk” files. By default, junk files are desktop.ini, thumbs.db and .tmp files although you can add to or edit this list in the program’s options. Press either the green or blue buttons to select all empty or junk folders or selectively check the boxes for individual folders.
You can also add folders to ignore (5 system folders are already included), folders and files to protect from deletion, and keep backups of the deleted folders for later restoration. To enable the backup option go to Tools > Options and select Keep Backups. The program will ask for administrative privileges after you press the delete button if administrator protected folders are listed for deletion.
Other potentially useful empty folder deleting programs we tried include Empty Folders Finder (part of Glary Utilities), JoseDelEmpty, Vanity Remover, Empty Folder Finder and DelEmpty (GUI based).
Note: Some tools were ineffective in finding the real number of empty folders on our system. The tools above found thousands but Advanced SystemCare Free only found 23 empty folders and Puran Delete Empty Folders found just 7. You are welcome to try these programs but we found they were nowhere near thorough enough to be considered truly useful.
Delete Empty Folders From the Command Line or Scripts
Letting a dedicated program find and delete empty folders is the best choice for users of all skill levels. Advanced users might also want some extra options like being able to delete empty folders from the command line or batch scripts. Here are a few ways to do that using third party command line and built in Windows utilities.
5. DelEmpty (by Intelliadmin)
There is another tool called DelEmpty that has a GUI but this one is made solely for the command line. The main arguments to remove folders and subfolders from a given path are:
The -D argument is required and tells the tool to delete empty folders, the -S will optionally include sub-folders. Two other useful arguments are -Y which requires confirmation to delete each folder and -L lists the folders to be deleted without deleting anything. This is useful if you want to redirect the folder list to a text file. DelEmpty is also able to delete zero byte files by including -F, run the tool without arguments for a list.
6. RmEmpty
For complete ease of use while deleting empty folders from the command line, this old tool from around the year 2000 is about as simple as it gets.
RmEmpty pathtofolder [pathtofolder2]
Supply at least one folder as an argument and RmEmpty will search the path recursively and delete empty folders. Multiple path arguments can be included so you can delete from several different base folders at once.
7. Windows RoboCopy Command
There are several different ways in which you can delete empty folders using built in Windows commands, most require the use of a For loop. The Robocopy (Robust File Copy) tool is much easier and a simple trick forces it to remove all empty folders in the given path. Robocopy is available as standard in Windows Vista and above.
Robocopy pathtofolder samepathtofolder /S /Move
Instead of supplying a different source and destination folder you simply use the same for both. The addition of /Move tries to move the files from and to the same location, so Robocopy skips them. The extra /S argument forces Robocopy to also move subfolders but not empty folders. Only the empty folders are processed and deleted while everything else is skipped because it already exists. This leaves all files and non empty folders completely intact.
Note: These tools need to be run in an administrative Command Prompt or the script needs running as administrator for all folders to be processed on the C drive. Otherwise only those empty folders inside the current user’s folder will be deleted and those outside (such as in Program Files) will receive an access denied error message.