home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / oscpy251.zip / BTHSCOPY.CMD next >
OS/2 REXX Batch file  |  1993-08-23  |  4KB  |  112 lines

  1. /***********************************************************************
  2. BTHSCOPY.CMD is a batch SCOPYing utility written by C.E.Gaumer
  3. for C.E.Gaumer Software.  This routine facilitates SCOPYing
  4. groups of files by allowing the base filename and all the REMARKS to be
  5. specified before beginning the procedure.  These items are specified in a text
  6. file which can be created in an editor which has copy, cut & paste and other
  7. features that are not available from the command line.  When the procedure
  8. is run the user is prompted for the diskettes by the previously supplied
  9. REMARK for easy identification of the correct diskette.  The names of
  10. the individual SCOPY files are built from the base filename specified in
  11. the text with the disk number embedded, and the REMARK is passed to SCOPY
  12. for inclusion into the SCOPY file.  If an error occurs during SCOPYing
  13. of an individual diskette, the user is given the option to immediately
  14. retry that diskette without interrupting the continuing REXX procedure.
  15. *************************************************************************/
  16.  
  17. WorkFile=STRIP(arg(1))
  18. if length(WorkFile)=0 then Call HELP
  19. Drive=LINEIN(WorkFile)
  20. BaseFile=LINEIN(WorkFile)
  21.  
  22. ReplaceLocation= LASTPOS('*',BaseFile)
  23. if ReplaceLocation=0 then do
  24.         say 'Invalid base filename... must include "*" or "**"'
  25.         EXIT
  26. END
  27. IF LASTPOS('*',BaseFIle,ReplaceLocation-1)=0 then do
  28.         ReplaceLength=1
  29. END
  30. ELSE do
  31.         ReplaceLength=2
  32.         ReplaceLocation=ReplaceLocation-1
  33. END
  34. TotalDisks=0
  35.         Junk=LINEIN(WorkFile)
  36. DO WHILE LENGTH(Junk)>0
  37.         Junk=LINEIN(WorkFile)
  38.         TotalDisks=TotalDisks+1
  39. END
  40. LINEIN(WorkFile,1,0)
  41. Drive=LINEIN(WorkFile)
  42. BaseFile=LINEIN(WorkFile)
  43.  
  44. if TotalDisks>100 then do
  45.         say ' BTHSCOPY can only handle 99 diskettes per set'
  46.         EXIT
  47. END
  48. if ReplaceLength=1 & TotalDisks>9 then do
  49.         say ' Cannot BTHSCOPY more than 9 diskettes with only one replaceable'
  50.         say '    character in Base Filename'
  51.         EXIT
  52. END
  53.  
  54. DiskNum=1
  55.  
  56. Remark=LINEIN(WorkFile)
  57.  
  58. DO FOREVER
  59. DiskNum=STRIP(DiskNum)
  60. if LENGTH(DiskNum)<ReplaceLength then DiskNum='0'||Disknum
  61. if LENGTH(remark)=0 then leave
  62. '@echo off'
  63. cls
  64. say Insert the diskette for
  65. say ''
  66. say remark
  67. say ''
  68. say '(Disk number 'DiskNum' )'
  69. say 'In drive 'Drive
  70. FileName=OVERLAY(DiskNum,BaseFile,ReplaceLocation,ReplaceLength)
  71. Say "Diskette will be SCOPY'd to "FileName
  72. pause
  73. 'ECHO 'remark' | SCOPY 'Drive' 'FileName' /r'
  74. if rc>0 then do
  75. say 'AN ERROR OCCURRED DURING THE SCOPY OPERATION'
  76. say '   Repeat Operation? (Y/n)'
  77. drop response
  78. PULL response .
  79. if SUBSTR(response,1,1) <> 'N'then iterate
  80. end
  81. Remark=LINEIN(WorkFile)
  82.  
  83. DiskNum=DiskNum+1
  84. END
  85. EXIT
  86.  
  87.  
  88. HELP:
  89. say 'BthScopy is a BaTcH SCOPY procedure for SCOPYing a group'
  90. say ' of diskettes into files.  The REXX procedure takes a single parameter'
  91. say ' which is the full name of a file containing the information required'
  92. say ' to create the SCOPY files.  This file must be an ASCII text file'
  93. say ' with the information in the file arranged EXACTLY'
  94. say ' in the order listed below (one entry per line) '
  95. say '     The diskette drive that will hold the diskettes (with the colon)'
  96. say '     The base name for the group of files with "*" replacing number(s)'
  97. say '         the numbers will be one or two digits decided by the number'
  98. say '         of asterisks in the base filename given'
  99. say '     The remark for the first file in the group'
  100. say '     The remark for the second file in the group'
  101. say '     The remark for the third file in the group'
  102. say '          continuing for all files in the group'
  103. say 'The example file below is correct for a series of two files which '
  104. say 'will be read from Drive A: to the files PROG1of2.SCP and PROG2of2.SCP'
  105. say 'A:'
  106. say 'PROG*of2'
  107. say 'This is the REMARK for Diskette 1'
  108. say 'Here is the second Diskette Remark'
  109. say 'The numbers included in the filenames are generated and added to the'
  110. say ' base filename automatically by the REXX procedure '
  111. EXIT
  112.