Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
for /F %%i in ('dir /b "C:\Program Files\Apache folder\*.*"') do (
   echo Folder is NON empty
   goto launch_app
)
  • How to check a folder is empty?

    I tried above command, but it didn't work.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

try this:

for /F %%i in ('dir /b /a "C:\Program Files\Apache folder\*"') do (
    echo if you see this the folder is NOT empty
    goto launch_app
)
share|improve this answer
    
its says system cannot find the path specified. i have Apache folder in that location. inside apache i have one more folder. but still getting error. –  Bobby Rachel Jul 19 '13 at 12:00
    
To check for more folders, remove the -d option from dir. –  Endoro Jul 19 '13 at 12:23
    
i tried removing -d still it says system cannot find the path specified. –  Bobby Rachel Jul 19 '13 at 13:31
    
I'm not sitting at your monitor, can't see your folders .... –  Endoro Jul 19 '13 at 13:32
    
ok get cool.. no problem. i will try something else. –  Bobby Rachel Jul 19 '13 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.