home *** CD-ROM | disk | FTP | other *** search
- : MAKELIST.BTM
- : Itamar Even-Zohar, B10@taunivm.bitnet / B10@vm.tau.ac.il (internet)
- : Saved July 31, 1992; 'temp' routine fixed August 19, 1992
-
- : MAKELIST.BTM creates a list for specified files, then calls this list
- : to screen using Buerg's LIST, or 4DOS internal list command, or Nota Bene
- : file calling is done via the CA sub-program in my EX.BTM. If this
- : does not exist on your disk, Buerg's LIST, or 4dos list will be used.
- : Note:
- : Drive and path are added to each filename in the list. If none is
- : indicated, current path and drive are added. To override, add /d
- : to your command.
- : Usage:
- : MAKELIST filename(s) [/d]
-
- if "%1" == "" goto usage
-
- setlocal
- call %@search[settemp.btm]
- rem If you have not defined "temp" in your Autoexec.Bat file,
- rem "temp" will be defined as your last available drive. If you
- rem have a ramdrive, the list of files will be created on it;
- rem otherwise, it will be created on the root of your default
- rem drive.
- REM check if 'temp' contains a trailing backslash
-
- set makelist=%temp%list.tmp
-
- iff exist %makelist then
- del /q %makelist
- endiff
-
- :exist_file?
- if exist %1 goto check_switch
- goto notfound
-
- :check_switch
- iff %@index[%&,/d] lt 0 then
- goto check_d&p
- endiff
-
- :plain_list
- rem This will create a file list without drive and path before
- : each name.
- (echo List of files for %@upper[%1] - %_dow, %_date, %_time^echo.
- ^) dir /b %1 >%makelist
- goto call_list
-
- :check_d&p
- rem The following procedures check if you indicated drive and /or
- : path in your command. If you haven't, either path and / or drive
- : are added before list is created.
- iff not %@index[%1,:] gt 0 .and. not %@index[%1,\] ge 0 then
- set f=%_cwd\%1
- elseiff %@index[%1,:] gt 0 .and. not %@index[%1,\] ge 0 then
- set f=%1
- elseiff not %@index[%1,:] gt 0 .and. %@index[%1,\] ge 0 then
- set f=%_disk:%1
- endiff
-
- :d&p_list
- (echo List of files for %@upper[%f] - %_dow, %_date, %_time^echo.
- ^) dir /fkm %f >%makelist
-
- rem The following procedure is equivalent to the one above; but
- rem 4DOS "dir" options are faster and neater.
- : *for %n in (%f) do (
- : echo %n >>%makelist)
-
- :call_list
- gosub editor
- %call %makelist
- endlocal
- quit
-
- :notfound
- echo File(s) %@upper[%1] not found
- endlocal
- quit
-
- :usage
- text
-
- SYNTAX:
-
- MAKELIST filename(s) [/d]
-
- where /d = no drive & path in front of each filename
- endtext
- quit
-
- :***************** SUB-ROUTINES *************************
-
- :editor
- iff not "%@search[EX.BTM]" == "" then
- set call=ca
- else
- gosub Buerg
- endiff
- return
-
- :Buerg
- rem Checks if Buerg's LIST exists; else sets
- rem 4DOS internal command ("list").
- iff not "%@search[list.com]" == "" then
- set call=%@search[list.com] %1& /w
- else
- set call=*list
- endiff
- return