Folder - Delete from Command Prompt

How to Delete a Folder in Windows from the Command Prompt


   Information
This will show you how to permanently delete a Folder in Vista, Windows 7, or Windows 8 using the RD or RMDIR command from within a command prompt.

This can be handy if you cannot delete the folder using the normal methods.

   Note
While you can run this command in a non-elevated or elevated command prompt, you would get the best results using a elevated command prompt.

   Warning
The folder will be deleted immediately and not placed in the Recycle Bin first. Deleting a folder using this command will also delete all of it's contents as well as the folder. Be sure to backup anything you want to keep in the folder first.


EXAMPLE: RD and RMDIR Command
NOTE: You can use either the RD or RMDIR command in the command prompt. They are the same command.
About_RD_RMDIR.jpg




Here's How:
1. Do step 2 or 3 below for where you would like to use a command prompt at.


2. To Use a Elevated Command Prompt in Windows
A) Open an Elevated command prompt in Vista/Windows 7 or Windows 8, and go to step 4 below.
3. To Use a Command Prompt at Boot
A) Open a command prompt at boot in Vista/Windows 7 or Windows 8, and go to step 4 below.

B) In the command prompt, type diskpart and press Enter. (see screenshot below)

C) In the command prompt, type list volume and press Enter. (see screenshot below)
NOTE: This will let you see what the drive letter is for the drive that you want to delete the folder in since it may not always be the same drive letter that it is in Windows.

D) After making note of the drive letter, type exit and press Enter. (see screenshot below)
Command-1.jpg
4. In the command prompt, type the command below and press enter.
NOTE: Substitute Full Path of Folder within quotes below with your folder's full path within quotes instead.

Code:
RD /S /Q "[COLOR=red][B]Full Path of Folder[/B][/COLOR]"

NOTE: For example, if I wanted to delete a folder named Folder on my desktop, I would type this command below.

Code:
RD /S /Q "C:\Users\UserName\Desktop\Folder"
Elevated_Command_Prompt.jpg
5. The folder should now be deleted.

6. Close the command prompt.
NOTE: If you used a command prompt at boot, then also close the System Recovery Options window and restart the computer.
That's it,
Shawn




 
Last edited:
Bringing back memories from 30 years ago.
I thought everyone know that. :D

DOS RULEZ!
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 10 Pro
CPU
Intel i5
Motherboard
I have a fatherboard
Memory
I'm old and lost a few chips
Graphics Card(s)
Yup
Sound Card
Yup
Monitor(s) Displays
Samsung 32" UHD
Screen Resolution
3840 x 2160
Hard Drives
Samsung 860 EVO drives
PSU
450 Watt and some fans that blow
Case
Small tower
Cooling
Yes I am cool. lol
Keyboard
Who needs a keyboard?
Mouse
Logitech Laser G7 wireless
Internet Speed
Zippy fast UP and DOWN
Antivirus
I got a shot
Browser
The new Improved EDGE 2020
Hello Iggy (John ;) ),

Yeah, we've been having a few folks not being able to delete folders normally, so I thought this could help with that. DOS does rule. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Thank you worked like a charm :party::party::party:
 

My Computer

Computer Manufacturer/Model Number
hp pavilion dv9700
OS
windows 7 ultimate was Vista home premium
Motherboard
Quanta 30 d1
Memory
3072 MBs
Graphics Card(s)
NVIDIA GeForce 7150M / nForce 630M
Screen Resolution
1140 x 900
PSU
AMD Turion 64 X2 Mobile Technology TL-60 2000 Mhz
Guess it's too much to suggest to them:
rd /s /q %userprofile%\desktop\foldername
 

My Computer

Computer Manufacturer/Model Number
Toshiba Satellite S875D-S7239 laptop
OS
MS Windows 7 Ultimate SP1 64-bit
CPU
AMD A10-4600M
Motherboard
AMD Pumori (Socket FT1)
Memory
6.00 GB Dual-Channel DDR3 @ 798MHz (11-11-12-28)
Graphics Card(s)
AMD Radeon HD 7660G
Sound Card
High Definition Audio Device
Monitor(s) Displays
Generic PnP Monitor (1600x900@60Hz)
Screen Resolution
1600x900@60Hz
Hard Drives
SSD 119GB Corsair CSSD-V128GB2 ATA Device
Keyboard
Standard PS/2 Keyboard
Mouse
HP Wireless Optical Mobile Mouse Model FHA-3410
Internet Speed
What the local pub, local coffee shop offers.
Other Info
Optical Drive:MATSHITA BD-CMB UJ160B ATA Device


Also have an Asus ha1002xp netbook with Win 7 Ultimate installed.
Hello Karl,

For only the C:\User\(user-name) location, that would be fine.

I just used the normal full path version since it would be a better example for all situations. Plus, the %path% may not work so well if a command prompt at boot is used. That's all. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Hello Shawn,
I agree.
Karl
 

My Computer

Computer Manufacturer/Model Number
Toshiba Satellite S875D-S7239 laptop
OS
MS Windows 7 Ultimate SP1 64-bit
CPU
AMD A10-4600M
Motherboard
AMD Pumori (Socket FT1)
Memory
6.00 GB Dual-Channel DDR3 @ 798MHz (11-11-12-28)
Graphics Card(s)
AMD Radeon HD 7660G
Sound Card
High Definition Audio Device
Monitor(s) Displays
Generic PnP Monitor (1600x900@60Hz)
Screen Resolution
1600x900@60Hz
Hard Drives
SSD 119GB Corsair CSSD-V128GB2 ATA Device
Keyboard
Standard PS/2 Keyboard
Mouse
HP Wireless Optical Mobile Mouse Model FHA-3410
Internet Speed
What the local pub, local coffee shop offers.
Other Info
Optical Drive:MATSHITA BD-CMB UJ160B ATA Device


Also have an Asus ha1002xp netbook with Win 7 Ultimate installed.
You're most welcome Faridfaiz, and welcome to Seven Forums. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Hello Iggy (John ;) ),

Yeah, we've been having a few folks not being able to delete folders normally, so I thought this could help with that. DOS does rule. :)

Arrgh! It's not DOS!!! ;) If I try anything with Int 21h Windows 7 will not only reprimand me but ship me off to Jersey as well...
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Apple
OS
El Capitan / Windows 10
CPU
i7-4980HQ
Memory
16GB
Graphics Card(s)
Iris 5200
Hi
I tried what you said and most of the contents of the folder was deleted but one subfolder I've got message: "Access is denied".
What I suppose to do to delete this folder ?
Thanks in advance.
 

My Computer

OS
Windows 7 Ultimate x64
CPU
Intel(R) Core(TM)2 Quad Q6600
Motherboard
ASUS P5K Deluxe/WiFi-AP
Memory
4.00 GB
Graphics Card(s)
NVIDIA GEForce 8800 GTX
Sound Card
SoundMAX Intergrated Digital HD Audio
Monitor(s) Displays
LG Flatron Wide 22"
Hello Zungul,

What's the full path of the folder? I just wanted to make sure that this is not a important Windows system folder that should not be deleted first. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Thanks Shawn

Sure this will come in handy

Danny
 

My Computer

Computer Manufacturer/Model Number
acer aspire 5935g
OS
Windows 7 Home Premium x64 SP1
CPU
intel(R)core(TM)2 duo CPU T6600 @ 2.20GHz
Motherboard
intel gm45/gm47 revision 07
Memory
3 gb ddr3
Graphics Card(s)
ati radeon hd4570/512mb
Monitor(s) Displays
lop156wh2-tle1 15.3 flat
Screen Resolution
1366x768
Hard Drives
OCZ-Agility3 60gig ssd
320gig external hdd
500gig external hdd
Mouse
Optical
Internet Speed
30Mbps Down/30Mbps Up
You're welcome Danny. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Need Help With Folder

This is the path of the folder I want to delete.

Z:\Kevin\MEGA\JDownloader\Kevin

I just tried this in Command Prompt and I get this message.
1.JPG

I have tried everything to delete this folder and nothing seems to work. I have tried Unlocker, LockHunter. This is the message I get when I try to right click and delete it.

I have also tried sfc/scannow and chkdsk and nothing. This is not the drive the OS is on.

2.JPG

Properties Image Of Folder:
3.JPG4.JPG

Thanks,

Kevin
 
Last edited:

My Computer

Computer Manufacturer/Model Number
HP Pavilion p6140f / Modifications
OS
Windows 7 Ultimate x64-bit SP1
CPU
Intel Core 2 Quad Q9650 3.00GHz
Motherboard
ASUS IPIBL-LB
Memory
8GB PC2-6400 DDR2 Copper Heat Spreaders
Graphics Card(s)
XFX GeForce 9400GT 1GB DDR2 PCI Express 2.0
Sound Card
High Definition Audio
Monitor(s) Displays
Acer 22" x223w, Acer 19" G205H
Screen Resolution
1680 x 1050, 1600 x 900
Hard Drives
128 GB Crucial RealSSD C300 (OS)
750 GB WD Caviar Black 7200RPM Serial ATA HDD
2 TB WD Caviar Green Serial ATA HDD
2 X 1 TB WD Caviar Green Serial ATA HDD
2 X 1.5 TB Seagate FreeAgent USB 2.0 7200RPM
500 GB Seagate FreeAgent USB 2.0 7200RPM
PSU
Sunbeam 650W ATX12V V2.3
Case
HP Case
Keyboard
Microsoft SideWinder X6 Black Keyboard
Mouse
Microsoft SideWinder X8 Black 2.4GHz Wireless 4000
Internet Speed
http://www.speedtest.net/result/951887022.png
Hello Kevin,

Did you also try deleting it from a command prompt at boot?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
I had the same problem Kevin, this is what worked

I had the same problem Kevin and this is what worked for me...

*do not type in the "s below

1. Open the command prompt (cmd.exe)
2. go to the directory that the folder is in...example: I want to delete the folder "C:\Users\Noodle\Downloads\Plumb - Hang On (The Remixes)" so type "cd C:\Users\Noodle\Downloads"
3. at this point you should be at C:\Users\Noodle\Downloads in the cmd window. Now type in "dir /a /x /p"
4. You will get a list of the directories in the folder and the one I'm interested in was

07/04/2010 19:08 <DIR> PLUMB-~1 Plumb - Hang On (The Remixes)

5. I ran the cmd.exe as admin (when it opens your prompt should be "c:\windows\system 32>"). Now I typed in...

rd /s /q "C:\Users\Noodle\Downloads\PLUMB-~1" (this time leave the "s in)

6. check to make sure the folder is deleted and you should be done.

From my understanding and I'm not a guru at this, there is naming issue and although the folder should have been named "Plumb - Hang On (The Remixes)", it is recognized as "PLUMB-~1". Anyways, I had the same problem and this is what worked for me. I hope this helps and good luck.

Norp

PS the example I used, I patched together from different sites that I used to figure this out.
 
Last edited:

My Computer

OS
Win 7 ult
@Shawn Yes I did.

@Norp Didn't work.

I just went ahead and copied files to a different drive and then formatted the drive. Everything is good now.

Thanks Again,

Kevin
 

My Computer

Computer Manufacturer/Model Number
HP Pavilion p6140f / Modifications
OS
Windows 7 Ultimate x64-bit SP1
CPU
Intel Core 2 Quad Q9650 3.00GHz
Motherboard
ASUS IPIBL-LB
Memory
8GB PC2-6400 DDR2 Copper Heat Spreaders
Graphics Card(s)
XFX GeForce 9400GT 1GB DDR2 PCI Express 2.0
Sound Card
High Definition Audio
Monitor(s) Displays
Acer 22" x223w, Acer 19" G205H
Screen Resolution
1680 x 1050, 1600 x 900
Hard Drives
128 GB Crucial RealSSD C300 (OS)
750 GB WD Caviar Black 7200RPM Serial ATA HDD
2 TB WD Caviar Green Serial ATA HDD
2 X 1 TB WD Caviar Green Serial ATA HDD
2 X 1.5 TB Seagate FreeAgent USB 2.0 7200RPM
500 GB Seagate FreeAgent USB 2.0 7200RPM
PSU
Sunbeam 650W ATX12V V2.3
Case
HP Case
Keyboard
Microsoft SideWinder X6 Black Keyboard
Mouse
Microsoft SideWinder X8 Black 2.4GHz Wireless 4000
Internet Speed
http://www.speedtest.net/result/951887022.png
Kevin,

I'm happy to hear that you got it sorted. :)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Access to file denied

I can get to the directory I want to delete but I get a message that access is denied when I try to delete either folders or files. This is happening with 5 folders of left-over update stuff.
 

My Computer

Computer Manufacturer/Model Number
HP G60
OS
Windows 7 Home Premium
CPU
Dual Core T4200
Motherboard
HP
Memory
4 GB
Back
Top