home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / cdcr206a.zip / CDCONVRT.CMD < prev    next >
OS/2 REXX Batch file  |  1995-10-29  |  16KB  |  49 lines

  1. /*                           CD Carousel                                   */
  2. /*                         by Bill Esposito                                */
  3. /*                              v2.06a                                     */  
  4. /*                       The Cereal Port BBS                               */
  5. /*                            1:132/152                                    */
  6. /*                          (603)899-3335                                  */
  7. /*                                                                         */
  8. /*                         Magic name 'CDCAR'                              */
  9. /*                         for latest version                              */
  10. /*                                                                         */
  11. /* *********************************************************************** */
  12. /* DISCLAIMER:  This software is provided "AS IS" without any warranty of  */
  13. /* any kind, either expressed or implied.  USE IT AT YOUR OWN RISK.        */
  14. /*                                                                         */
  15. /* Copyright 1993, 1994, 1995 by Bill Esposito.  This program is SHAREWARE.*/
  16. /* Please read the file SHAREWRE.TXT included in this archive.             */
  17. /*                                                                         */
  18. /* CD Carousel and it's support programs are not to be modified or         */
  19. /* distributed in modified form without the express written permission of  */
  20. /* The author, Bill Esposito.                                              */
  21. /* *********************************************************************** */
  22. /*                     *****  CDCONVRT.CMD  *****                          */
  23. /* REXX util to add Size and Date to Files.bbs.  The resultant lists will  */
  24. /* be placed in a subdirectory to the CD Carousel directory (homedir).     */
  25. /***************************************************************************/
  26. Arg task me;justcopy='N';'@echo off';filesbbs='files.bbs';config=cdcar''task'.cfg';f=1;do until lines(config)=0;  param.f=linein(config);  f=f+1;end;ok=stream(config,c,'close');parse var param.3 homedir junk;rc=sysmkdir(homedir'tmp');tmpdir= homedir'tmp';;call RxFuncAdd 'SysloadFuncs','RexxUtil','Sysloadfuncs';call sysloadfuncs;        grn='';        yel='';        red=''
  27.         blu='';        cyan='';        brt='';        gry='';        lo='';redo:;cls;say brt||red'                       CD Carousel Disk Setup Utility';say;say cyan;say 'Enter a name for the CD you wish to install.  This name must conform';say 'to the naming convention for a FAT file.  That means that the filename';say 'must not be longer than 8 characters and not contain spaces, commas,';say 'periods, or backslashes.  'red'DO NOT ADD A FILE EXTENTION.'cyan;say  ;say 'This name will also be used to identify to both yourself and your users';say 'this CD, so it should be simple, descriptive, and use only letters and';say 'numbers.  Example: Simtel20';say;
  28. say blu'Enter the name for this CD:';call syscurpos 12, 27;pull disk;if length(disk) > 8 then do;  say red'Disk name should be 8 characters or less';  call redo;end  ;say;say cyan'Enter the Drive leter of your CDrom:';say 'example   L';call syscurpos 14, 36;pull cdrom1;cls;say;say;say cyan'Do the file lists on the disk contain multiline descriptions similar to the';say 'ones listed below?';say;say blu'CDCAR_11.ZIP    45190  12-28-93  CD Carousel 1.1 Max/2 offline file req door  ';say 'CDTHRU.ZIP       9275  02-14-94  Small OS/2 utility that tests the throughput '
  29. say '                                 of a CD drive at various blocksizes.         ';say 'CEDIT10.ZIP     62891  01-23-94  Cedit Norton Editor compatible text editor   ';say 'CENVI22.ZIP    226260  10-14-93  CEnvi v1.005; Cmm (C minus minus) is C for ';say '                               | the rest of us. CEnvi runs Cmm programs in   ';say '                               | the DOS, Windows, OS/2, NT, Unix, etc...     ';say '                               | environments. Together, CEnvi and Cmm make   ';say '                               | the power and flexibility of the C           ';say '                               | programming language part of every computer  ';say '                               | users environment, without the hardware,    ';say '                               | time, and programmer resources needed for    ';say '                               | developing full-blown C programs.            ';                                                                                                                                                                                                                                                                                       ;say cyan'Select (y,N)'; temp= translate(sysgetkey())  ;if temp <>'Y' then temp='N';;say;say blu'Does each directory contain a Files.bbs? (Y,n)'; bbsyes= translate(sysgetkey())  ;if bbsyes <>'N' then bbsyes = 'Y'
  30. if bbsyes='Y' then skip='Y';if bbsyes='N' then do;say;say cyan'Are the file lists all contained in one directory AND are they named';say 'after the directory? (Y,n)';onedir= translate(sysgetkey());if onedir<>'N' then onedir='Y'; if left(onedir,1) <>'N' then do; say; say blu'Enter the full path to the file lists (ex. k:\lists):'; pull listpath; say; say cyan'Enter the file extention.  If none then enter "NO"'; pull ext; if left(ext,2)<>'NO' then ext=left(ext,3); else ext=''; end ;end;if bbsyes='N' then if left(onedir,1) <>'Y' then do;say
  31. say cyan'Are there files lists in EACH directory and are the lists named after the directories? (Y,n)';samedir= translate(sysgetkey()); if left(samedir,1) <>'N' then do; say; say blu'Enter the file extention.  If none then enter "NO"'; pull ext; if left(ext,2)<>'NO' then ext=left(ext,3); else ext=''; end ; if left(samedir,1) <>'Y' then do ;say;say cyan'Are there files lists in EACH directory and are the files containing the';say 'file info named the SAME for all directories? (Y,n)';same= translate(sysgetkey());if left(same,1) <>'N' then do ;say;say blu'Enter the name of the file containing the files listings:';pull filesbbs ; end;if left(same,1) ='N' then do 
  32. say;say cyan'Are the files containing the file info named DIFFERENTLY for all ';say 'directories? (Y,n)';samediff= translate(sysgetkey());end;if left(samedif,1) ='N' then do ;say;say cyan'Are the file lists all contained in one directory AND are they named';say 'after the directory? (Y,n)';onedir= translate(sysgetkey()); if left(onedir,1) <>'N' then do; say; say blu'Enter the full path to the file lists (ex. k:\lists):'; pull listpath; say; say cyan'Enter the file extention.  If none then enter "NO"'; pull ext; if left(ext,2)<>'NO' then ext=left(ext,3); else ext=''; end 
  33. end;end;end;say;if bbsyes='N' then if samedir='N' then if onedir='N' then if same='N' then do;say;say red'Sorry, cant translate this disk :(';say 'Press Any Key to continue';ok=sysgetkey();signal done;end;say;say blu'Do the Files.bbs on this disk already contain date/size information? (y,N)';justcopy = translate(sysgetkey())  ;if left(justcopy,1) <>'Y' then justcopy = 'N';say;if left(same,1) <> 'N' then do ;say;say cyan'Do you want to be prompted for each directory found? (y,N)';incl = translate(sysgetkey())
  34. if incl <> 'Y' then incl = 'N';say;end;if left(same,1) = 'N' then if onedir = 'Y' then do ;say;say cyan'Do you want to be prompted for each directory found? (y,N)';incl = translate(sysgetkey());if incl <> 'Y' then incl = 'N';say;end;bbsdiff:;if left(same,1) = 'N' then if onedir <>'Y' then do;say;say cyan'You will be prompted at each directory found, for a filename of the index';say 'file,(files.bbs alternative) And a NAME for the file area.';incl='Y';end ;;sort:;say
  35. say blu'Do you want the directories to be sorted by Area Name? (Y,n)';sort = translate(sysgetkey());if sort <> 'N' then sort ='Y';privl:;say;say cyan'Enter the first letter of the user privilege level required to access this Disk';say cyan'(example: "n" for normal, "p" for privel etc.)';priv = translate(sysgetkey());if priv <> 'S' then if priv <>'A' then if priv <>'C' then if priv <>'E' then if priv <>'F'    then if priv <>'P' then if priv <>'W' then if priv <>'N' then if priv <>'L'    then if priv <>'D' then if priv <>'T' then signal privl;if priv='S' then priv = '10';if priv='A' then priv = '9';if priv='C' then priv = '8';if priv='E' then priv = '7';if priv='F' then priv = '6';if priv='P' then priv = '5';if priv='W' then priv = '4';if priv='N' then priv = '3';if priv='L' then priv = '2';if priv='D' then priv = '1';if priv='T' then priv = '0'
  36. say;keys:;say;say blu'Enter the numbered key between 1 and 8 if required to access this Disk';say blu'(Enter a percent sign "%" for no key)';key = translate(sysgetkey());if key <>'' then if key > 10 then signal keys;if key <>'' then if key =0 then signal keys;if key =' ' then key = '%';say;cdrom=left(cdrom1,1)':\';rc=sysmkdir(homedir''disk);if rc=206 then say 'An invalid name was used.';if rc=5 then say 'Path already exists';if rc <> 0 then do;   say red'An error occured while trying to create the directory.';   say 'If the Path already exists and you still wish to contine, select 'Y'';   say 'Otherwise please correct the error and try again.'cyan;   cont = translate(sysgetkey());   if cont<>'Y' then exit
  37. end;cls;say;say 'Please wait, scanning the CDROM.....';if same='N' then call sysfiletree cdrom'*.*','dirs.' ,'OSD';else call sysfiletree cdrom||filesbbs,'dirs.' ,'OS';if samedir='Y' then call sysfiletree cdrom'*.'ext,'dirs.' ,'OS';if onedir='Y' then call sysfiletree listpath'\*.'ext,'dirs.' ,'OS';dn=1;total=dirs.0;do i=1 to dirs.0;if skip='Y' then if bbsyes='Y' then do; dirsr=reverse(dirs.i); parse var dirsr bbs'\'names.dn'\'rest; llgnth=length(bbs)+1; llng=length(dirs.i)-llgnth; dirs.i=left(dirs.i,llng); name=reverse(names.dn); end;if same='Y' then if bbsyes='Y' then do
  38.  dirsr=reverse(dirs.i); parse var dirsr bbs'\'names.dn'\'rest; llgnth=length(bbs)+1; llng=length(dirs.i)-llgnth; dirs.i=left(dirs.i,llng); name=reverse(names.dn); end;if same='Y' then if bbsyes='N' then do; dirsr=reverse(dirs.i); parse var dirsr bbs'\'names.dn'\'rest; llgnth=length(bbs)+1; llng=length(dirs.i)-llgnth; dirs.i=left(dirs.i,llng); name=reverse(names.dn); end;if samediff='Y' then if bbsyes='N' then do; dirsr=reverse(dirs.i); parse var dirsr names.dn'\'rest; name=reverse(names.dn); end
  39. if samedir='Y' then if bbsyes='N' then do; dirsr=reverse(dirs.i); parse var dirsr bbs'\'rest; name=reverse(bbs); names.dn=name; bbs=reverse(bbs)'.'ext; end;if onedir='Y' then if bbsyes='N' then if samediff <>'Y' then do; dirsr=reverse(dirs.i); if ext='' then parse var dirsr bbs'\'rest; else parse var dirsr ex'.'bbs'\'rest; name=reverse(bbs); dirs.i=cdrom||reverse(bbs); names.dn=name; bbs=reverse(bbs); end; ;          if incl='Y' then do;             say;             say blu'Include 'cyan||dirs.i||blu' in the list of available file areas? (y,n,a)'
  40.              infname = translate(sysgetkey());             if infname<>'Y' then if infname<>'N' then infname = 'Y';             if infname = 'N' then names.dn = 'esposito';             if infname='Y' then if same = 'N' then do;             say;             say cyan'Enter the filename.ext of the file containing the files.bbs information.';             pull filesbbs;             say;             say blu'Enter the name of this directory';             pull name;             names.dn=name;                          end;          end   ;    if infname <> 'N' then do b = 1 to total ;    if names.b=names.dn then if b <> dn then call rename;   end; if incl='Y' then if left(infname,1)='Y' then call lineout homedir''disk'\names.lst',name dirs.i; if incl='Y' then if left(infname,1)='A' then do;    incl='N';    cls
  41.     say red'Aborting File Area Prompting'blu; end   ; if incl='N' then call lineout homedir''disk'\names.lst',name dirs.i; if infname <> 'N' then call lineout homedir''disk'\names.dup',name ; ok=stream(homedir''disk'\names.lst',c,'close'); ok=stream(homedir''disk'\names.dup',c,'close'); dn=dn+1;end; ;dl='disk.lst';call lineout dl,priv key disk ;'@cd 'homedir''disk ;do until lines('names.lst')=0;  ;   parse value linein('names.lst') with areaname fulldirectory;   if samedir='Y' then filesbbs = areaname'.'ext ;   if onedir='Y' then filesbbs = areaname'.'ext ;   if onedir='Y' then origdir=fulldirectory ;   if onedir='Y' then fulldirectory=listpath ;   bill=fulldirectory'\'filesbbs
  42.    ok=stream(areaname'.bbs',c,'open');   say cyan'Processing 'bill||grn '--->' cyan||areaname'.bbs';   ok=stream(bill,c,'open');   if temp='Y' then call bar2;if temp='Y' then bill=tmpdir'\filesbbs.tmp';    ok=stream(bill,c,'close');   if justcopy ='N' then do;        do until lines(bill)=0;        filen=linein(bill);         parse var filen filename rest ;          if left(filen,1)<>' 'then if left(filen,1)<>'-' then if datatype(left(filen,1),'S') =1 then call size  ;        ok=stream(areaname'.bbs',c,'close');       end;   end;   if justcopy='Y' then do;    ok=stream(bill,c,'close');    ok=stream(areaname'.bbs',c,'close');       do until lines(bill)=0;          filen=linein(bill);          parse var filen filename szz dtt rest
  43.              if left(filen,1)<>' 'then if left(filen,1)<>'-' then if datatype(left(filen,1),'S') =1 then call jcopy  ;        ok=stream(areaname'.bbs',c,'close');       end;   end;   ok=stream(bill,c,'close');end;sort:;ok=stream(homedir''disk'\names.lst',c,'close') ;if sort='Y' then do;say 'Sorting...';  '@cd' homedir||disk;  '@sort <'homedir||disk'\names.lst >'homedir||disk'\names.tmp';  '@del' homedir||disk'\names.lst >nul';  '@ren names.tmp names.lst >nul';end;ok=stream(homedir||disk||'\dupes.tmp',c,'close');ok=stream(homedir||disk||'\names.dup',c,'close');'@del' homedir||disk||'\dupes.tmp >nul';'@del' homedir||disk||'\names.dup >nul';if me=1 then do
  44.   homedirr=left(homedir,(length(homedir)-1)) ;  cd homedirr;end;  call cdmenu task;exit;size:;rest1=strip(rest);if onedir='Y' then fulldirectory=origdir;call sysfiletree fulldirectory'\'filename, 'list.','f';if list.0=0 then return;   do i=1 to list.0;       lists=list.i;       parse var lists date time size1 ea name;   end;new= left(filename,13)''right(size1,8)''right(date,9)'  'rest1;call lineout homedir''disk'\'areaname'.bbs',new;return;jcopy:;rest1=strip(rest);if onedir='Y' then fulldirectory=origdir
  45. call sysfiletree fulldirectory'\'filename, 'list.','f';if list.0=0 then return;   do i=1 to list.0;       lists=list.i;       parse var lists date time size1 ea name;   end;new= left(filename,13)''right(szz,8)''right(dtt,9)'  'rest1;call lineout homedir''disk'\'areaname'.bbs',new;return;rename:;say;say  red||name||blu' is a duplicate directory name, please a unique name (8 characters)';say 'to represent 'cyan||dirs.i||blu;pull un;if un='' then signal rename;names.dn=reverse(un);name=reverse(names.dn);ok=stream(homedir||disk'\dupes.tmp',c,'close');do until lines(homedir||disk'\dupes.tmp') = 0;   parse upper value linein(homedir||disk'\dupes.tmp') with check
  46.    parse upper var name cname; if strip(check) = strip(cname) then say grn'Already used, try again!'blu; if strip(check) = strip(cname) then  signal rename; end;ok=stream(homedir||disk'\dupes.tmp',c,'close');call lineout homedir||disk'\dupes.tmp', cname;ok=stream(homedir||disk'\dupes.tmp',c,'close');do until lines(homedir||disk'\names.dup') = 0;   parse upper value linein(homedir||disk'\names.dup') with check;   parse upper var name cname; if strip(check) = strip(cname) then say grn'Already used, try again!'blu; if strip(check) = strip(cname) then  signal rename;end;ok=stream(homedir||disk'\names.dup',c,'close');b=total;return;done:;call cdmenu task;/* */;bar2:
  47. first=1;output='';ft=1;'@del' tmpdir'\filesbbs.tmp >nul';do until lines(bill)=0;filein=linein(bill);if left(filein,5)<>'     ' then if first=1 then do;  output=output' 'filein;  first=0;end ;if left(filein,5)<>'     ' then if first=0 then if ft <> 1 then do;   call lineout tmpdir'\filesbbs.tmp', output;   output=filein ; end            ;ft=0 ;if left(filein,5)='     ' then output=output' 'strip(filein);end;    ok=stream(bill,c,'close');return;IN.465
  48. IN.466;IN.467;IN.468;IN.469;IN.470;IN.471;IN.472;IN.473;IN.474;IN.475;IN.476;IN.477;IN.478;IN.479;IN.480;IN.481;IN.482;IN.483;IN.484;IN.485
  49.