Looking at this further I've discovered a problem with "RMDIR /S" and DOS generated short directory names. If the directory is empty RMDIR will delete it no matter how you specify the name. However if the directory is not empty "RMDIR /S will only remove the directory if you specify the full name. In other words:
A directory named
C:\My Files, that contains files and/or directories, can be removed if you use the line
RMDIR /S "C:\My Files"
If that same directory has a DOS generated short file name of
myfile~1 and it contains files and/or directories the line:
RMDIR /S myfile~1
will error with "The directory is not empty"
If you have a copy of "DELTREE.EXE" that shipped with Windows 95, you can use it instead of RMDIR /S. DELTREE,EXE has worked on every windows operating system since Win95. The same code from above would be ammended to:
Code: Select all
Let>RP_WAIT=1
Let>RP_WINDOWMODE=1
Run>cmd /c dir "[drive]:\[path]\*.*" /ad /X /N >%TEMP_DIR%~directorylist~
Let>_counter_=0
Label>start
add>_counter_,1
ReadLn>%TEMP_DIR%~directorylist~,%_counter_%,line
If>line=##EOF##,done
If>line=,start
midstr>line,1,1,test
If>%test%=%SPACE%,start
midstr>line,53,1,test
If>%test%=.,start
midstr>line,40,1,test
If>%test%=%SPACE%
midstr>line,53,100,subsubdir
Else
midstr>line,40,12,subsubdir
EndIf
Let>test=
Let>line=
Let>cmdcmd=cmd /c "[Drive]:\[Path]\deltree.exe" /Y "[Drive]:\[Path]\%subsubdir%"
Run>%cmdcmd%
Goto>start
Label>done