• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Help with DOS syntax for file deletion


martienne

New Member
Member
European Union

Posts
128
#1
I am looking for the correct DOS syntax to achieve the following:

In folder "C:\ABC":

1) Delete ALLA folders, including their content.
2) Delete any files that are in the root of "C:\ABC"

I have tried a combination of RMDIR and DEL but I am not managing to delete folders.
I can't find any examples of syntax online.

Any idea how to achieve this?
 

My Computer

System One

  • OS
    Win 8.1
    Computer type
    PC/Desktop
    CPU
    i5
    Motherboard
    ASUS
    Memory
    24 GB DDRAM3
    Graphics Card(s)
    NVIDIA GT430 x2
    Sound Card
    Audial
    Monitor(s) Displays
    2 x 28" Sharp
    Screen Resolution
    1360 x 768
    Hard Drives
    Samsung, Seagate, Toshiba, Hitachi, Western Digital
    PSU
    750 watt
    Cooling
    liquid closed

alphanumeric

slightly off center
VIP Member
Guru
Gold Member
#2
Technically its not DOS, its a command shell. Have a look at this, Del Try del /? for a list of options.
 

My Computer

System One

  • OS
    Windows 10 Education 64 Bit
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Asus
    CPU
    AMD Phenom II X4 980 Black Edition Deneb 3.7GHz
    Motherboard
    ASUS M4N68T-M V2 µATX Motherboard
    Memory
    8GB 4GBx2 Kingston PC10600 DDR3 1333 Memory
    Graphics Card(s)
    NVIDIA Geforce GT640 2 Gig DDR3 PCIe
    Sound Card
    VIA VT1708s High Definition Audio 8-channel Onboard
    Monitor(s) Displays
    22" LG E2242 1080p and 2 19" I-INC AG191D
    Screen Resolution
    1280x1024 - 1920x1080 - 1280x1024
    Hard Drives
    Crucial MX100 256 GB SSD and 500 GB WD Blue SATA
    PSU
    Thermaltake TR 620
    Case
    Power Up Black ATX Mid-Tower Case
    Cooling
    Stock heatsink fan
    Keyboard
    Logitech Wireless K350 Wave
    Mouse
    Logitech M570 Trackball and T650 TouchPad
    Internet Speed
    80 Mbps Down 30 Mbps Up
    Browser
    Internet Explorer 11
    Antivirus
    Windows Defender
    Other Info
    HP DVD1040e Lightscribe - External USB2

oneeyed

New Member
Pro User
Posts
328
#3
Use DELTREE
Syntax : DELTREE [/Y] [drive:]path [[drive:]path[...]]

So in your case : DELTREE /Y C:\ACB
It will delete the ACB directories and all its subdirectories, files included. The /Y switch suppresses the prompt that asks for confirmation of each folder's deletion.
You'll have to recreate the directory though. You can still do that under the command shell, type :
C: (redirects you to drive C)
CD \ (redirects you to the root of the drive)
MD ACB (creates the directory)

Be careful with DELTREE, it can be very dangerous if not used right.

Edit :
My bad, DELTREE doesn't exist anymore in this version of windows (still existed under XP I think, sigh). Here is the equivalent now :
rd C:\ACB /s
 

My Computer

System One

  • OS
    Windows 8.1 (x64)
    Computer type
    PC/Desktop

topgundcp

Well-Known Member
VIP Member
Guru
San Jose - California

Posts
2,847
#4
Use: rd /S /Q [dir] ======> [dir] is the folder you want to remove => remove everything in [dir] including [dir] itself.
 

My Computer

System One

  • OS
    8.1x64PWMC Ubuntu14.04x64 MintMate17x64
    Computer type
    PC/Desktop
    System Manufacturer/Model Number
    Home Brewed
    CPU
    I7 4970K OC'ed @4.7 GHz
    Motherboard
    MSI-Z97
    Memory
    16 GB G-Skill Trident X @2400MHZ
    Graphics Card(s)
    NVIDIA GeForce GTS 450
    Sound Card
    X-Fi Titanium Fatal1ty Professional Series
    Monitor(s) Displays
    Dual HP-W2408
    Screen Resolution
    1920X1200
    Hard Drives
    256 GB M2 sm951, (2) 500GB 850EVO, 5TB, 2 TB Seagate
    PSU
    Antec 850W
    Case
    Antec 1200
    Cooling
    Danger Den H20
    Keyboard
    Logitech
    Mouse
    Logitech Performance Mouse MX
    Internet Speed
    35/12mbps
    Browser
    Firefox