home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
diskutil
/
scopy2
/
bthscopy.cmd
next >
Wrap
OS/2 REXX Batch file
|
1993-06-20
|
4KB
|
112 lines
/***********************************************************************
BTHSCOPY.CMD is a batch SCOPYing utility written by C.E.Gaumer
for C.E.Gaumer Software. This routine facilitates SCOPYing
groups of files by allowing the base filename and all the REMARKS to be
specified before beginning the procedure. These items are specified in a text
file which can be created in an editor which has copy, cut & paste and other
features that are not available from the command line. When the procedure
is run the user is prompted for the diskettes by the previously supplied
REMARK for easy identification of the correct diskette. The names of
the individual SCOPY files are built from the base filename specified in
the text with the disk number embedded, and the REMARK is passed to SCOPY
for inclusion into the SCOPY file. If an error occurs during SCOPYing
of an individual diskette, the user is given the option to immediately
retry that diskette without interrupting the continuing REXX procedure.
*************************************************************************/
WorkFile=STRIP(arg(1))
if length(WorkFile)=0 then Call HELP
Drive=LINEIN(WorkFile)
BaseFile=LINEIN(WorkFile)
ReplaceLocation= LASTPOS('*',BaseFile)
if ReplaceLocation=0 then do
say 'Invalid base filename... must include "*" or "**"'
EXIT
END
IF LASTPOS('*',BaseFIle,ReplaceLocation-1)=0 then do
ReplaceLength=1
END
ELSE do
ReplaceLength=2
ReplaceLocation=ReplaceLocation-1
END
TotalDisks=0
Junk=LINEIN(WorkFile)
DO WHILE LENGTH(Junk)>0
Junk=LINEIN(WorkFile)
TotalDisks=TotalDisks+1
END
LINEIN(WorkFile,1,0)
Drive=LINEIN(WorkFile)
BaseFile=LINEIN(WorkFile)
if TotalDisks>100 then do
say ' BTHSCOPY can only handle 99 diskettes per set'
EXIT
END
if ReplaceLength=1 & TotalDisks>9 then do
say ' Cannot BTHSCOPY more than 9 diskettes with only one replaceable'
say ' character in Base Filename'
EXIT
END
DiskNum=1
Remark=LINEIN(WorkFile)
DO FOREVER
DiskNum=STRIP(DiskNum)
if LENGTH(DiskNum)<ReplaceLength then DiskNum='0'||Disknum
if LENGTH(remark)=0 then leave
'@echo off'
cls
say Insert the diskette for
say ''
say remark
say ''
say '(Disk number 'DiskNum' )'
say 'In drive 'Drive
FileName=OVERLAY(DiskNum,BaseFile,ReplaceLocation,ReplaceLength)
Say "Diskette will be SCOPY'd to "FileName
pause
'ECHO 'remark' | SCOPY 'Drive' 'FileName' /r'
if rc>0 then do
say 'AN ERROR OCCURRED DURING THE SCOPY OPERATION'
say ' Repeat Operation? (Y/n)'
drop response
PULL response .
if SUBSTR(response,1,1) <> 'N'then iterate
end
Remark=LINEIN(WorkFile)
DiskNum=DiskNum+1
END
EXIT
HELP:
say 'BthScopy is a BaTcH SCOPY procedure for SCOPYing a group'
say ' of diskettes into files. The REXX procedure takes a single parameter'
say ' which is the full name of a file containing the information required'
say ' to create the SCOPY files. This file must be an ASCII text file'
say ' with the information in the file arranged EXACTLY'
say ' in the order listed below (one entry per line) '
say ' The diskette drive that will hold the diskettes (with the colon)'
say ' The base name for the group of files with "*" replacing number(s)'
say ' the numbers will be one or two digits decided by the number'
say ' of asterisks in the base filename given'
say ' The remark for the first file in the group'
say ' The remark for the second file in the group'
say ' The remark for the third file in the group'
say ' continuing for all files in the group'
say 'The example file below is correct for a series of two files which '
say 'will be read from Drive A: to the files PROG1of2.SCP and PROG2of2.SCP'
say 'A:'
say 'PROG*of2'
say 'This is the REMARK for Diskette 1'
say 'Here is the second Diskette Remark'
say 'The numbers included in the filenames are generated and added to the'
say ' base filename automatically by the REXX procedure '
EXIT