home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / makedsks.zip / makedsks.cmd
OS/2 REXX Batch file  |  1994-03-10  |  4KB  |  92 lines

  1. /* OS/2 REXX Procedure to make diskettes out of disk images *
  2.  * using the loaddskf utility from IBM.                     *
  3.  *                                                          *
  4.  * This is a generic utility that will prompt the user      *
  5.  * for every .dsk file found in the current directory and   *
  6.  * invoke LOADDSKF to create that diskette from the image.  *
  7.  *                                                          *
  8.  * Execution syntax is:                                     *
  9.  *                                                          *
  10.  * makedsks images drive ( loaddsks_options                 *
  11.  *                                                          *
  12.  * where images is the file names to use (e.g. *.dsk)       *
  13.  *       (path is not supported as current dir is assumed)  *
  14.  *       drive is the drive name (e.g. a:)                  *
  15.  *       loaddskf_options may be:                           *
  16.  *                 /f = format                              *
  17.  *                 /y = don't prompt for format ok          *
  18.  *                                                          *
  19.  * defaults:  images: *.dsk                                 *
  20.  *            drive: a:                                     *
  21.  *                                                          *
  22.  * Prompting is once per disk image:                        *
  23.  *                                                          *
  24.  * "Q" - quits this process                                 *
  25.  * "S" - skips the specific disk image                      *
  26.  * any key invokes loaddskf with /F (format)                *
  27.  *                          and  /Y (don't prompt)          *
  28.  *                                                          *
  29.  * Author:     Lionel B. Dyck                               *
  30.  *             Rockwell International                       *
  31.  *             P.O. Box 2515                                *
  32.  *             Seal Beach, California 90740                 *
  33.  *             (310) 797-1125                               *
  34.  *             IBMMail:  USROKNTN                           *
  35.  *             Internet: lbd@osreq48.rockwell.com           *
  36.  *             IBMLINK:  ROK2027                            *
  37.  *                                                          *
  38.  * History:                                                 *
  39.  * 02/28/94 - created                                       *
  40.  * 02/28/94 - updated w/sugg by Gerald Meazell              *
  41.  *                                                          *
  42.  * -------------------------------------------------------- */
  43.  
  44. arg images drive "(" ld_opts
  45.  
  46. if strip(ld_opts) = "" then
  47.    ld_opts = "/f /y"
  48.  
  49. if length(images) = 0 then do
  50.    images = "*.dsk"
  51.    drive = "a:"
  52.    end
  53.  
  54. if length(drive) = 0 then drive = "a:"
  55.  
  56. if length(drive) = 1 then drive = drive":"
  57.  
  58. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  59. call SysLoadFuncs
  60.  
  61. current_dir = directory()
  62. lc = length(current_dir)+2
  63. x  = SysFileTree(images,'files','f')
  64.  
  65. do  fi = 1 to files.0
  66.     parse value files.fi with id1 id2 size at name
  67.     dsk.fi = substr(strip(name),lc)
  68.     call make_disk dsk.fi
  69.     end
  70.  
  71. exit
  72.  
  73. make_disk:
  74. arg disk_image
  75.  
  76. call beep 125,100
  77. call beep 150,100
  78. call beep 175,100
  79. Say " "
  80. Say "Insert new diskette into drive" drive "for disk image:" disk_image
  81. Say "Press 'S' to skip, 'Q' to quit, or any key to make the disk"
  82. key = sysgetkey()
  83. key = translate(key)
  84.  
  85. Select
  86.   when key = "Q" then exit
  87.   when key = "S" then return
  88.   otherwise "Loaddskf" disk_image drive ld_opts
  89.   end
  90. return
  91.  
  92.