home *** CD-ROM | disk | FTP | other *** search
- /* This AREXX program, dir.rexx, inserts directory information in a
- TWIST database using the CLI command LIST. */
-
- /* ------------------------------------------------------------------------ INIT */
-
- say
- say "This AREXX programm inserts a directory into a database."
- say "Name of database must be ""directory.db"" and fields must be named:"
- say " ""Filename"" of type txt"
- say " ""Size"" of type int"
- say " ""Date"" of type date"
- say "The program uses the CLI command 'LIST' but has only been tested on"
- say "version 37.5. Your version of 'LIST' is:"
- say
- address command 'version c:list'
- say
- say "Enter path to insert (empty=current, q=quit):"
- pull dirpath
-
- if ((dirpath == "Q") | (dirpath == "QUIT")) then exit
-
- say "Listing files"
- address command 'list' dirpath 'nohead dates lformat "%d %l,%n" >ram:t/tmp_dir_rexx'
- address twist open 'prg/directory.db'
- call open 'input','ram:t/tmp_dir_rexx','R'
- say "Inserting file list into prg/directory.db"
- /* -----------------------------------------------------------------------INSERT */
-
- do while (EOF('input')=0)
- linie = readln('input')
- if (length(linie) > 8) then
- do
- dato = left(linie,9)
- stridx = index(linie,",")
- stoerrelse = substr(linie,11,stridx-11)
- filnavn = right(linie,length(linie)-stridx)
- if (filnavn ~= "tmp_dir_rexx") then
- address twist insert 'Filename' 'Size' 'Date' as filnavn stoerrelse dato
- end
- end
-
- /* ----------------------------------------------------------------------- CLOSE */
-
- call close 'input'
- address twist close
- address command 'delete quiet ram:t/tmp_dir_rexx'
- say "done"
-