Page 1 of 1

Deleting a directory structure

Posted: 09 May 2012 01:00
by balubeto
HI

With the command prompt of Windows 7 SP1, how do I delete a directory structure with their files without deleting the name of the root directory?

THANKS

BYE

Re: Deleting a directory structure

Posted: 09 May 2012 01:25
by foxidrive
Untested: syntax is: delfolder.bat "c:\test folder"


Code: Select all

@echo off
pushd "%~1"&&(rd "%~1" /s /q 2>nul&popd)

Re: Deleting a directory structure

Posted: 09 May 2012 01:44
by balubeto
foxidrive wrote:Untested: syntax is: delfolder.bat "c:\test folder"


Code: Select all

@echo off
pushd "%~1"&&(rd "%~1" /s /q 2>nul&popd)


Ok.

THANKS

BYE