Solved Delete multiple folders using script

June 9, 2012 at 04:24:09
Specs: Windows XP
I am looking to delete multiple folders using a bat file. See my example below

20120608.016
20120608.017
20120608.018
20120608.019
20120608.020

I need to delete all folders except the latest one which is 20120608.020.

Can someone help me with a script for this?


See More: Delete multiple folders using script

Report •

#1
June 9, 2012 at 07:45:11
✔ Best Answer
:: ===== script starts here ===============
::
:: hais.bat Sat 09-06-2012 21:34:43.92
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* skip=1 delims= " %%a in ('dir/b/o-n 20120608.*') do (
rd/s/q %%a
)

goto :eof

::====== script ends here =================


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question