General discussion

  • Creator
    Topic
  • #2342055

    DOS – How to delete all files and subdirectories in a dir but not the dir

    Locked

    by dbrunt1 ·

    DOS – How to delete all files and subdirectories in a directory.

    By CharlieSpencer · 9 years ago

    Okay, not really DOS, but from a Windows Server command prompt.

    I’m trying to remember how to delete all files, subdirectories, and subdirectory contents from a specific directory from a command prompt. We have a “catch all” folder for short-term file sharing and I want to delete the contents nightly, but not the folder itself, using a scheduled command procedure.

    Unfortunately I’m the poster boy for the American CRS Foundation and have forgotten how to do this. RMDIR won’t take a wildcard. DELTREE is apparently dead and gone. I’m currently using

    DEL /F /Q /S C:\Directory\*.*

    but that leaves the empty subdirs in place.

    Help. Thanks.

All Comments

Viewing 0 reply threads