Skip navigation

JSI Tip 2057. How can I delete all files and subfolders in the current folder?

In Windows NT 4.0, and Windows 2000, the following command will delete all subfolders and files in the current folder:

RD /S ""

Even though you receive The system cannot find the path specified, all files and folders are deleted.

NOTE: If you don't want the Are you sure? prompt:

@echo Y|RD /S ""

NOTE: Microsoft advises against the use of the NULL ("") folder.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.