1.

Solve : Batch Script Help Needed?

Answer»

I need HELP with a batch script that will do the following:
Check to SEE if any folders or files exist in C:\Temp and if it does DELETE all folder in C:\Archive. If no folders or files exist in C:\Temp leave C:\Archive alone.

Thanks
Without knowing your OS it's darn near impossible to say whether this will work, but hey, you never know till you try.

Code: [Select]@echo off
SET count=0
for /F %%i in ('dir c:\temp') do (
call set /a count=%count%+1
)
if %count% GTR 0 for /f %%i in ('dir /a:d /b c:\archive') do rd /q /s c:\archive\%%i

Based on your specs, only folders are deleted from archive. 8-)



Discussion

No Comment Found