home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
clrlib.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-12
|
3KB
|
78 lines
/* This REXX utility, used in conjunction with Golden Commpass, */
/* automatically erases any catalog files when a download file */
/* containing a "DIR" command is detected. (e.g. when you are */
/* going to refresh the catalog from CompuServe) This, in */
/* effect, "cleans out" your catalog so only new entries are */
/* shown after the download. */
/* This function can be called from GCP */
/* GCP automatically before each online session by adding it */
/* to page three of the "Online" section in the settings */
/* notebook, under "pre-processing exit", as OS/2, BG. You */
/* must specify the full path name for your Messages path. */
/* (It doesn't matter if you include the trailing slash or not) */
/* Example: clrlib D:\COMM */
/* Comments are welcome! Peter A. Kazmir 71501,336 */
/* Load relevant functions */
call rxfuncadd 'SysFileTree', 'RexxUtil','SysFileTree'
call rxfuncadd 'SysFileSearch', 'RexxUtil','SysFileSearch'
call rxfuncadd 'SysFileDelete', 'RexxUtil','SysFileDelete'
/* Clear flag */
del=0
/* Get pathname of Messages directory */
parse arg directory
/* Make sure the path does not have a trailing slash */
directory=strip(directory , 'T' , '\' )
/* Check for valid pathname */
call SysFileTree directory , 'dirx' , 'DO'
if (length(directory)=0 | dirx.0=0) then do
say ''
say 'ERROR: Invalid or missing pathname'
say ''
say 'The syntax for this command is:'
say ''
say ' clrlib <dir> '
say ''
say 'where <dir> is your GCP Messages Path (ex: D:\COMM).'
exit
end
/* Check for DOWnload files in the directory; give list to files array */
call SysFileTree directory'\*.DOW' , 'files' , 'FO'
/* For each file found, search for word "DIR" in the file. If found, */
/* delete cooresponding CATalog file in the directory. */
do i = 1 to files.0
call SysFileSearch 'DIR' , files.i , 'line' , 'N'
if line.0 > 0 then do
/* Set flag */
del=1
/* Create filename to delete (d:\path\forum.CAT) */
file_kill=substr(files.i,1,length(files.i)-4)'.CAT'
/* Delete file and pass return code */
rc=SysFileDelete(file_kill)
if rc=0 then say file_kill' deleted.'
else if rc=2 then say file_kill' does not exist.'
else say rc': Error deleting' file_kill
end
end
/* If no CATalog files were printed, print message */
if del=0 then say 'No files were found to delete.'
exit