Windows 8 and 8.1 Forums

Help with DOS syntax for file deletion

  1. #1

    Help with DOS syntax for file deletion

    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 System SpecsSystem Spec

  2. #2

    Sydney, Nova Scotia, Canada
    Posts : 6,476
    Windows 10 Education 64 Bit

    Technically its not DOS, its a command shell. Have a look at this, Del Try del /? for a list of options.
      My System SpecsSystem Spec

  3. #3

    Posts : 328
    Windows 8.1 (x64)

    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 System SpecsSystem Spec

  4. #4

    San Jose - California
    Posts : 2,846
    8.1x64PWMC Ubuntu14.04x64 MintMate17x64

    Use: rd /S /Q [dir] ======> [dir] is the folder you want to remove => remove everything in [dir] including [dir] itself.
      My System SpecsSystem Spec

Help with DOS syntax for file deletion

Similar Threads
Thread Forum
Secure deletion program for Windows 8.1;
I am planning to get a new computer soon and would like to securely overwrite the information from deteted files. I tries using Eraser, but I get a message saying I need to run as administrator, even after I run it as administrator. I think it doesn't work with Windows 8.1. Is there a tool that I...
Software and Apps
One Drive deletion of files
How do I stop One Drive from deleting files when I delete files from my pc? I want to try using One Drive for storage again but last time I used it, the online files disappeared when I deleted them from the One Drive folder on my pc.:mad:
Software and Apps
Recycle Bin Being Bypassed on Deletion
I accidently deleted an image I wanted to use online so went to the bin to retrieve it. It had been permanently deleted without passing through the bin. This is something that has only appeared (or disappeared) in the past day or so. I run MS Defender, but there is notihng in settings I...
General Support
Problem with pnputil syntax
Hi, I'm trying to install Intel Wifi Drivers using pnputil.exe with the command below but it appears I have the syntax wrong and it just displays the help information. It seems though that what I've entered in bold is the same as the MS example. Does anyone know where I'm going wrong? ...
Drivers & Hardware
system recovery files folder deletion
i have recently installed windows 8.1 and i just realized that i have a folder of system recovery files which was o windows 7. i have tried to delete them through disk clean up but no luck. i have tried to delete them but it tells me that i need adminstrator permission which i am the...
General Support
Accidental deletion of a Metro app
While I have been running W8 on my my laptop for a few months, I am at a point of wanting an OE Metro app back that I discarded during setup. It was simple (and now I know wrong) to uninstall the icon from the desktop, rather then to unpin. Shoot me it was the excitement of the new OS;) Well...
Browsers & Mail
OS Choose option shows Ubuntu also after deletion
I previously used ubuntu in my Windows 8 Pro and Windows got many errors so i deleted the folder of ubuntu..did not uninstalled and all that. now it shows ubuntu on OS choose Screen. then i thought installing Ubuntu would overwrite the existing one..but sadly i have two Ubuntu is empty...
Installation & Setup

Eight Forums Android App Eight Forums IOS App Follow us on Facebook