Solved Batch script to check an empty folder

November 14, 2014 at 01:13:09
Specs: Windows XP
I have my folder at this path:
c:\ Test
and i would like to determine if my forder c:\Test\Receive is empty and if it is FALSE I would like to move the files of Receive folder in c:\ Test

Please help.


See More: Batch script to check an empty folder

Report •

November 14, 2014 at 02:42:02

@echo off & setlocal
cd C:\test\receive
set cnt=0
for %%j in (*) do set /A cnt+=1
if %cnt% equ 0 (echo. Folder is empty & goto :EOF)
move * .. > nul
echo. %cnt% files moved

Report •

November 17, 2014 at 05:29:07
✔ Best Answer
I resolved my problem in this way:

cd c:\sftp\receive\ReceiveBIX

for /F %%i in ('dir /b "c:\sftp\receive\ReceiveB\*.*"') do (
echo Folder is NON empty
ftp -i -v -s:"C:\ftp\Alert_B.txt"



Report •
Related Solutions

Ask Question