Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 68,063 of 68,980    |
|    Herbert Kleebauer to Tom Del Rosso    |
|    Re: list endpoint folders    |
|    20 May 23 17:49:44    |
   
   From: klee@unibwm.de   
      
   On 20.05.2023 10:33, Tom Del Rosso wrote:   
   > How do you operate on all folders in a tree that don't have subfolders,   
   > so just the endpoints?   
   >   
   > The obstacle is that if you test a folder with DIR /AD it always returns   
   > . and .. and never errorlevel 1.   
   >   
      
   @echo off   
   for /f %%i in ('dir /ad /s /b') do call :sub %%i   
   goto :eof   
      
   :sub   
   pushd %1   
   set last=true   
   for /f %%j in ('dir /ad /s /b') do set last=false   
   popd   
      
   if %last%==true echo %1 has no subdirectories   
   if %last%==false echo %1 has subdirectories   
   goto :eof   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca