I'm looking for a script/tool that will delete all subfolders under a
specific folder that are 0k in size on a Windows 2003 File Server.

The following is the path where "#" would be the top level folder. Any 0k
sized folders under this folder would need to be removed.

D:\Datashare\Clients$\CLIENTFI\#
--
Santhosh Pallikara

Re: Script to delete sub folders by Pegasus

Pegasus
Tue Mar 11 17:20:28 CDT 2008


"Santhosh" <Santhosh@discussions.microsoft.com> wrote in message
news:9FE4B36A-EF46-45E7-A8F6-4E9FD0AFE650@microsoft.com...
> I'm looking for a script/tool that will delete all subfolders under a
> specific folder that are 0k in size on a Windows 2003 File Server.
>
> The following is the path where "#" would be the top level folder. Any 0k
> sized folders under this folder would need to be removed.
>
> D:\Datashare\Clients$\CLIENTFI\#
> --
> Santhosh Pallikara

You could run this batch file:
@echo off
set source=D:\Datashare\Clients$\CLIENTFI\#
for /F "tokens=*" %%* in ('dir /ad /b "%source%"') do call :Sub %%*
goto :eof

:Sub
for /F "tokens=3" %%a in ('dir "%source%\%*" /s /-c ^| find /i "file(s)"')
do set size=%%a
if %size%==0 echo rd /s /q "%source%\%*"

Remove the word "echo" in the last line in order
to activate the batch file.