TIP: Click on subject to list as thread! ANSI
echo: 4dos
to: KLAUS MEINHARD
from: JOHN HENTSCH
date: 1998-05-21 22:49:00
subject: 2.btm

Klaus, I didn't write this but I found it to be a very nice and useful
BTM. MAybe someone in the echo recognizes the work and name the author:
2.BTM:
@echo off
if "%1"=="##" .and. isdir %2 (pushd %2 %+ quit 0)
setlocal
unalias *
do a=1 to %#
        if %@index[%[%a],/]==0 (set opt=%opt %[%a] %+ iterate)
        set tar=%@trim[%tar %[%a]]
enddo
set opt=%opt %[2#cfg]
set col=%@dec[%_columns]
alias puts=scrput +0 0 %_fg on %_bg
iff %@len[%@eval[1/2=3]] ne 5 then
        echo Requires 4DOS 5.5 or Take Command
        quit 4
elseiff isdir %tar .and. %@index[%opt,a]==-1 then
        %_batchname ## "%tar"
elseiff %@index[%opt,s] ne -1 then
        :build
        on error goto error
        if %@index[%opt,s(] ne -1 set skip=%@word["()",1,%opt]
        set tmp=%@unique[%temp]
        set handle=%@fileopen[%_batchname,read]
        set tmphnd=%@fileopen[%tmp,write]
        if %handle==-1 .or. %tmphnd==-1 goto error
         setdos /x-456
         do until "%fl"=="::directory list::"
                puts Updating %_batchname +
                 set fl=%@fileread[%handle]
                 puts Updating %_batchname *
                 if %@filewrite[%tmphnd,%fl]==-1 goto error
         enddo
        if %@filewrite[%tmphnd,%@label[%_boot:]]==-1 goto error
        if %@fileclose[%handle]==-1 .or. %@fileclose[%tmphnd]==-1 goto error
        setdos /x0
        echo.
        do disk=67 to %@ascii[%_lastdisk]
                if %@cdrom[%@char[%disk]]==1 .or. %@ready[%@char[%disk]]==0 
.or
. %@index[%skip,%@char[%disk]] ne -1 iterate
                if %@remote[%@char[%disk]]==1 .and. %@index[%opt,/n]==-1 
iterat
e
                cdd %@char[%disk]:\
                global /iq gosub scan
        enddo
        move /q %tmp %_batchname
        if %@len[%tar] gt 0 %_batchname /q %opt %tar
elseiff %@index[%opt,m] ne -1 then
        echo Adding %tar to directory list.
        if not isdir %tar md %tar
        pushd %tar
        ffind /t":#%@word["\",-0,%_cwp]# %_cwd" %_batchname >& nul
        if %_?==2 echo :#%@word["\",-0,%_cwp]# %_cwd >> %_batchname
elseiff %@index[%opt,?] ne -1 .or. %@len[%tar]==0 then
        cls
        echo %@upper[%@filename[%_batchname]] - Directory Changer
        echo Version 7/96
        echo.
        echo Usage: %@upper[%@name[%_batchname]] 
[/A][/F][/M][/N][/Q][/S(except
ions)][/?] directory
        echo.
        echo        /A(lways Search)
        echo        /F(irst Directory)
        echo        /M(ake Directory)
        echo        /N(etwork Drives - Include in Scan)
        echo        /Q(uiet)
        echo        /S(can Drives)
        echo        /?(Usage Screen)
        quit 3
else
        ffind /t"%@label[%_boot:]" %_batchname >& nul
        if %_?==2 (echo Directory List Must Be Updated %+ goto build)
        set tmp1=%@unique[%temp]
        set tmp2=%@unique[%temp]
        ffind /vkmt":#%tar" %_batchname >! %tmp1
        (for %a in (@%tmp1) gosub filter) >! %tmp2
        :again
        iff %@lines[%tmp2]==0 .or. %@index[%opt,f] ne -1 then
                set choice=%@line[%tmp2,0]
        elseiff %@lines[%tmp2] ge 1 then
                set 
choice=%@select[%tmp2,0,%@eval[%col-%w],5,%col,Directories]
        elseiff %@len[%tar] gt 1 .and. %no ne 1 then
                set no=1
                echo Widening Search - Please Wait
                ffind /vkmt":#%@instr[0,1,%tar]" %_batchname >! %tmp1
                (for %a in (@%tmp1) gosub filter) >! %tmp2
                goto again
        elseiff %no==1 .or. %@len[%tar]==1 then
                iff %@index[%opt,q]==-1 then
                        inkey /c/k"yn" Directory not found - Rescan disk? 
(Y/N)
: %%pick
                else
                        echo Directory not found
                endiff
        endiff
        del /q %tmp1 %tmp2
        if "%pick"=="y" goto build
        if "%choice" ne "" %_batchname ## "%choice"
        quit 1
endiff
dir
quit 0
:error
setdos /x0
if %@fileclose[%handle]==-1 rem
if %@fileclose[%tmphnd]==-1 rem
if exist %tmp del /q %tmp
echo Error updating %_batchname
quit 2
:filter
if "%@word[-0,%a]"=="%_cwd" return
if not isdir %@word[-0,%a] return
set size=%@eval[%@len[%@word[-0,%a]]+3]
if %size gt %w .and. %size le %col set w=%size
echo %@word[-0,%a]
return
:scan
set str=%@format[-%col,Adding %_cwd].
echo :#%@word["\",-0,%_cwp] %_cwd >> %tmp
puts %str
return
::directory list::

jh -
 * WCE 2.1G1/2241 * 
--- ViaMAIL!/WC4 v1.40j
---------------
* Origin: Mail Box BBS Glendora, CA USA (1:218/907)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.