Pages

Wednesday, October 2, 2013

Batch - Deleting all the files and directories under a root directory

Hi!

With Windows 7, I need to delete all the files and subdirectory under a root directory.

I was able to achieve this task with theses two commands in a batch script

rmdir /S /Q MY_DIRECTORY
md MY_DIRECTORY

The first one deletes all the files and directory under MY_DIRECTORY but it deletes also the root directory. I recreate after the root directory.

It may not be the best way to achieve this but it works.

No comments:

Post a Comment