Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2012
    Thanked 58 Times in 57 Posts

    how to delete all of the contents in a folder

    I'm trying to develop a simple batch file to delete all of the contents in a folder on my brothers win 8.1 computer.
    This isn't working: DEL C:\Users\Mark\Documents\LDG 8_1\*.*
    How do I fix that?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Manning, South Carolina
    Thanked 1,455 Times in 1,324 Posts

    Microsoft Windows [Version 10.0.10586]
    (c) 2015 Microsoft Corporation. All rights reserved.
    C:\Windows\System32>del /?
    Deletes one or more files.
    DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
    ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
      names         Specifies a list of one or more files or directories.
                    Wildcards may be used to delete multiple files. If a
                    directory is specified, all files within the directory
                    will be deleted.
      /P            Prompts for confirmation before deleting each file.
      /F            Force deleting of read-only files.
      /S            Delete specified files from all subdirectories.
      /Q            Quiet mode, do not ask if ok to delete on global wildcard
      /A            Selects files to delete based on attributes
      attributes    R  Read-only files            S  System files
                    H  Hidden files               A  Files ready for archiving
                    I  Not content indexed Files  L  Reparse Points
                    -  Prefix meaning not
    If Command Extensions are enabled DEL and ERASE change as follows:
    The display semantics of the /S switch are reversed in that it shows
    you only the files that are deleted, not the ones it could not find.
    I'd add the /Q and /F switches per above.

    May the Forces of good computing be with you!


    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. The Following User Says Thank You to RetiredGeek For This Useful Post:

    cmptrgy (2016-04-28)

  4. #3
    Silver Lounger access-mdb's Avatar
    Join Date
    Dec 2009
    Oxfordshire, UK
    Thanked 153 Times in 146 Posts
    Is that really a space between LDG and 8_1? If it is, doesn't the whole string need to be in quotes?

    DEL "C:\Users\Mark\Documents\LDG 8_1\*.*"
    My reality check got lost in the mail.

  5. The Following User Says Thank You to access-mdb For This Useful Post:

    cmptrgy (2016-04-28)

  6. #4
    5 Star Lounger
    Join Date
    Jul 2012
    Thanked 58 Times in 57 Posts
    Thank you for your responses. Unfortunately I didn't have success in accomplishing that need. It's astounding how I can use xcopy to copy his data into that folder but can't delete the contents with the DEL command. I went on the internet and literally tried about 20 recommendations that went nowhere not only for me but also for the people who were trying to accomplish the same. But at least I got my brother can save his data now by manually deleting the contents with CTRL+A and then using the batch file xcopy command to paste new data back into that folder.

    Then while checking out what to do the computer informed him it's ready for the Windows 10 upgrade so we did that.

    Maybe I'll get back to that project but for now he'll settle for what is happening

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts