home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Database / MT281.DMS / in.adf / ARexx / dir.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-02-05  |  1.5 KB  |  48 lines

  1. /* This AREXX program, dir.rexx, inserts directory information in a
  2.     TWIST database using the CLI command LIST. */
  3.  
  4. /* ------------------------------------------------------------------------ INIT */
  5.  
  6. say
  7. say "This AREXX programm inserts a directory into a database."
  8. say "Name of database must be ""directory.db"" and fields must be named:"
  9. say "  ""Filename"" of type txt"
  10. say "  ""Size""     of type int"
  11. say "  ""Date""     of type date"
  12. say "The program uses the CLI command 'LIST' but has only been tested on"
  13. say "version 37.5. Your version of 'LIST' is:"
  14. say
  15. address command 'version c:list'
  16. say
  17. say "Enter path to insert (empty=current, q=quit):"
  18. pull dirpath
  19.  
  20. if ((dirpath == "Q") | (dirpath == "QUIT")) then exit
  21.  
  22. say "Listing files"
  23. address command 'list' dirpath 'nohead dates lformat "%d %l,%n" >ram:t/tmp_dir_rexx'
  24. address twist open 'prg/directory.db'
  25. call open 'input','ram:t/tmp_dir_rexx','R'
  26. say "Inserting file list into prg/directory.db"
  27. /* -----------------------------------------------------------------------INSERT */
  28.  
  29. do while (EOF('input')=0)
  30.     linie = readln('input')
  31.     if (length(linie) > 8) then
  32.     do
  33.         dato = left(linie,9)
  34.         stridx = index(linie,",")
  35.         stoerrelse = substr(linie,11,stridx-11)
  36.         filnavn = right(linie,length(linie)-stridx)
  37.         if (filnavn ~= "tmp_dir_rexx") then
  38.             address twist insert 'Filename' 'Size' 'Date' as filnavn stoerrelse dato
  39.     end
  40. end
  41.  
  42. /* ----------------------------------------------------------------------- CLOSE */
  43.  
  44. call close 'input'
  45. address twist close
  46. address command 'delete quiet ram:t/tmp_dir_rexx'
  47. say "done"
  48.