home *** CD-ROM | disk | FTP | other *** search
- @echo off
- : LED.BTM
- : Creates a list of all files with specified filepattern, with
- : their pathnames, found on disk, for further handling (1) via COMF.BTM
- : (for example, copying, or moving), or (2) via PKZIP (archiving).
- :
- : Purpose: To make it easier to reorganize hard disk, or create an archive.
- :
- : It allows to:
- : (*) Edit the list on-screen (one file after the other)
- : (accept, omit, delete, view, go to operation, or quit)
- : or
- : (*) Edit the list via your editor (change below, at ^^^)
- : or
- : (*) Create the list without interference
- : then
- : (*) Handle the list via COMF.BTM
- : or
- : (*) Handle the list via PKZIP
-
- : Written by Itamar Even-Zohar (b10@vm.tau.ac.il)
- : (Last edited September 11, 1992, April 6, 1993)
-
- : SYNTAX:
- : LED [-sMM-DD-YY] filepattern(s)
- : ("regular expressions" allowed)
- :-----------------------------------------------------------------------
- if .%1 == . goto HELP
-
- :check_whereis
- rem Finds out if Ledbetter's program is found on your path.
- iff "%@search[whereis.exe]" =="" .and. "%@search[SST.exe]" =="" then
- echo.
- echo You need Ledbetter's SST (formerly WHEREIS) to run this sub-program
- quit
- endiff
-
- setlocal
-
- :set_whereis
- rem Sets variable "whereis" to either WHEREIS or SST (whatever is
- : found on disk).
- iff "%@search[whereis.Exe]" =="" .and. not "%@search[SST.Exe]" =="" then
- set whereis=sst
- else
- set whereis=whereis
- endiff
-
- :set_temp
- call settemp
- :: (procedure which determines which drive will be "temp", if
- :: not defined by user in autoexec.bat.)
-
- :set_default
- : (modify items above ^^^, if desired)
- set rsp=%@upper[%temp%%0.rsp]
- set tmpf=%@unique[%temp]
- set edt=ped.exe
- rem ^^^^^^^ (change as desired)
- set zipfn=%temp%%0.zip
- rem ^^^^^^^^^^^^ (change as desired)
-
- :make_list
- %whereis %& -o"&f" > %rsp
- cls
-
- :edit?
- echo.
- inkey /K"SEOQ" S(creen) edit? E(ditor)? (O)perate, or Q(uit) %%rep
- cls
- iff %rep == %@char[27] .or. %rep == O then goto see_file?
- elseiff %rep == Y .or. %rep == @28 .or. %rep == S then ^set num=0^goto edit
- elseiff %rep == E then goto editor
- elseiff %rep == Q then set ech=echo %0 terminated by user; %rsp left intact^goto end
- endiff
-
- :edit
- rem This procedure displays all the files whose pattern was specified,
- : one by one, allowing you to (a) accept, or (b) delete, or (c) view
- : a file before making a decision, or (d) view the list of selections,
- : or (e) stop selecting and go to next application, or (f) quit.
- :
- iff %@eval[%num] gt %@lines[%rsp] then
- move /q %tmpf %rsp
- goto see_file?
- endiff
- set fn=%@line[%rsp,%num]
- scrput 0 0 black on white Accept=A/enter Omit=O/Esc D=Delete V=View G=Begin application L=View list Q=Quit
- echo.
- iff %_row lt 2 then
- screen 2 0
- endiff
- echo ==`>` %fn
- iff %_row ge %@eval[%_rows -1] then
- cls
- goto edit^endiff
- inkey /K"YNAODVGLQ[ESC][Enter]" (A)ccept? (O)mit? D(elete)? V(iew)? G(o)? (L)ist Q(uit)? %%rep
- iff %rep == %@char[27] .or. %rep == O .or. %rep == N then
- set num=%@eval[%num +1]
- goto edit
- elseiff %rep == A .or. %rep == @28 .or. %rep == Y then
- echo %fn >>%tmpf
- set num=%@eval[%num +1]
- goto edit
- elseiff %rep == D then
- del /q %fn
- echo ==`>` %fn deleted^echo.
- set num=%@eval[%num +1]
- goto edit
- elseiff %rep == V then
- *list %fn
- echo.^goto edit
- elseiff %rep == G then
- set num=%@eval[%@lines[%rsp]+1]
- goto application?
- elseiff %rep == L then
- *list %tmpf
- echo.^goto edit
- elseiff %rep == Q then set ech=echo.^echo %0 interrupted by user; %rsp left intact^goto end
- endiff
-
- :see_file?
- echo.
- inkey /K"YNQ[ESC][Enter]" See list of filenames? (Y/N)? %%rep
- iff %rep == %@char[27] .or. %rep == N then goto application?
- elseiff %rep == Y .or. %rep == @28 then
- *list %rsp
- endiff
-
- :application?
- cls
- echo.
- inkey /K"CPQ[ESC][Enter]" Handle file via (C)omfile? (P)kzip, or (Q)uit? %%rep
- iff %rep == C then goto comfile
- elseiff %rep == P then goto pkzip
- elseiff %rep == Q then
- set ech=echo %0 terminated by user; %rsp left intact
- goto end
- endiff
-
- :editor
- %edt %rsp
- goto application?
-
- :comfile
- input Type desired comfile command: %%cmd
- call comf %rsp %cmd
- set ech=
- goto end
-
- :pkzip
- echo.
- inkey (P)athnames? (N)ames only? (Q)uit? %%rep
- iff %rep == P then
- set pkz=pkzip -b%temp -P
- elseiff %rep == N then
- set pkz=pkzip -b%temp -u
- elseiff %rep == Q then goto end
- endiff
-
- echo.
- echo Type name of ZIP file (or 'enter' for default name)
- input --`>` %%rep
- iff "%rep"=="" then
- set zipfn=%zipfn
- else
- set zipfn=%rep.zip
- endiff
-
- :zip
- cls
- iff not exist %zipfn then set msg1=Creating
- else
- set msg1=Updating
- endiff
- scrput 1 0 bla on whi %msg1 %@upper[%zipfn] Wait ...
- screen 3 0
- %pkz %zipfn @%rsp
- gosub success
- goto end
-
- :end
- if exist %tmpf del /q %tmpf
- echo.
- %ech
- endlocal
- quit
-
- :-------------------HELP text-------------------------
- :help
- echo.
- echo %0.BTM creates a list of all specified filepattern(s), with
- echo their pathnames, for further handling (1) via COMF.BTM
- echo (for example, copying, or moving), or (2) via PKZIP (archiving).
- echo.
- echo Syntax is:
- echo %0 [-sMM-DD-YY] filepattern(s)
- echo ("regular expressions" allowed)
- echo.
- echo examples:
- echo %0 *.txt *.doc *.rep
- echo (for all *.txt *.doc *.rep files)
- echo %0 "docu"
- echo (for files with the string "docu" anywhere in name)
- echo %0 -s4-3-93 *.txt *.doc *.rep
- echo (for *.txt, etc., files created after 3rd April 1993)
- quit
-
- :==================SUB-ROUTINES=======================
- :success
- rem Checking results of archiving (with pkzip)
- iff errorlevel eq 12 then
- set ech=echo No archive created /updated
- else
- set ech=echo Archive %@upper[%zipfn] succesfully created /updated
- endiff
- return