home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / shadfl.zip / ShdFld.CMD
OS/2 REXX Batch file  |  1996-10-20  |  4KB  |  128 lines

  1. /* ShdFld.CMD */
  2. /*
  3.  by Louis McKinley  72162,1465
  4.  1996 10 06
  5.  Limited support available.
  6.  Use and/or distribute freely.  It has been tested on my system and believed
  7.  to be trouble free, but ...
  8.   *****************************
  9.   **  Use at your own risk.  **
  10.   *****************************
  11.  
  12.  DESCRIPTION:
  13.  This REXX program creates a folder on the desktop and populates it with 
  14.  shadows of files of your choice.  The files that you want to shadow can be
  15.  specified individually or can fit a file name pattern like that used at
  16.  the command line (e.g., *.TXT, THESEFILES*, ThisFile.ABC).  Each time this
  17.  REXX program is executed the folder will be updated to match the list of
  18.  files of interest.  The folder can be dragged from the desktop after it has
  19.  been created.
  20.  
  21.  The "parameters" are hard coded within, so follow the set of INSTRUCTIONS
  22.  that are shown at various places below.
  23.  
  24.  After running this program and it has created the folder and shadows:
  25.  If you desire to invoke this program from the popup menu of the folder
  26.  containing the shadows, then this is done by manually changing the
  27.  settings notebook for the folder.  Open the settings notebook and go to the
  28.  Menu page.  Under Actions on menu, click Create another....  In the Menu 
  29.  Items Settings dialog box enter something like "Refresh My Files" or "Update 
  30.  folder" in the Menu item name field; and in the Name field enter the path 
  31.  name of this REXX program.  Click OK and close the notebook.
  32.  
  33.  This program puts ObjectID data in the OS2.INI file, so it is recommended to
  34.  use a utility like UniMaint to regularly clean out data that becomes
  35.  obsolete.
  36.  
  37.  This REXX program opens up an annoying OS/2 window while it is running.
  38.  */
  39. /*'mode co1,1'*/
  40.  
  41. IF RxFuncQuery('SysLoadFuncs')THEN DO
  42.      IF RxFuncAdd('SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs') THEN DO
  43.         SAY 'Could not load RexxUtil library'
  44.         EXIT
  45.     END
  46.     CALL SysLoadFuncs
  47. END
  48.  
  49. RMDFolderID='<RMD_FOLDER>'
  50.  
  51. /* INSTRUCTIONS:
  52.  Enter the title of the folder that will contain
  53.  the shadows of the files that you want to shadow.
  54.  N.B. quotes.
  55.  */
  56. folderTitle='RMD Data'        /* title goes between the quotes */
  57.  
  58. /*
  59.  The folder will be created on the Desktop, if it
  60.  does not already exist.
  61.  */
  62. location='<WP_DESKTOP>'
  63. settings='OBJECTID=' || RMDFolderID || ';'
  64.  
  65. res=SysCreateObject('WPFolder',,
  66.         folderTitle,,
  67.         location,,
  68.         settings,,
  69.         'FAIL')
  70.  
  71. /*ARG control
  72. IF control = 'OPEN_FOLDER' THEN DO
  73.     IF \SysOpenObject(RMDFolderID, 'DEFAULT', '1') THEN DO
  74.         CALL Beep('100', '2000')
  75.     END
  76. END*/
  77.  
  78. n = 0
  79. /* INSTRUCTIONS:
  80.  Carefully enter the list of files to create the shadows of, using full
  81.  paths and a command line file pattern.  N.B. quotes.
  82.  
  83.  Each file specification should be on its own line in the following format:
  84.    n = n + 1; filesToShadow.n='path in quotes'
  85.  The only part of the line that is different for each file specification is
  86.  the information in the quotes.
  87.  
  88.  If you only need one file specification, then the list will look something like,
  89.  
  90.  n = n + 1; filesToShadow.n='C:\MEMOS\*.TXT'
  91.  
  92.  This will create shadows of all *.TXT files on C: drive in the \MEMOS\
  93.  directory, and put them in the target folder.
  94.  
  95.  End of comment.
  96.  */
  97.  
  98. /* Enter the list of file specifications here,
  99.  (delete or comment the example given here).
  100.  */
  101. n = n + 1; filesToShadow.n='C:\MEMOS\*.TXT'
  102. n = n + 1; filesToShadow.n='D:\DATALIST\DAY1\THESE?.*'
  103. n = n + 1; filesToShadow.n='D:\MOREDATA\*'
  104. n = n + 1; filesToShadow.n='D:\CONFIG.SYS'
  105.  
  106.  
  107. filesToShadow.0 = n
  108.  
  109. DO j = 1 TO filesToShadow.0
  110.     CALL SysFileTree filesToShadow.j, 'files.' , 'FO'
  111.  
  112. /* Try to create a shadow of every "filesToShadow.j" file.
  113.  */
  114.     DO i=1 TO files.0
  115.         file=FileSpec('NAME', files.i)
  116.         shadowID='SHADOWID=' || files.i || ';'
  117.         objectID='OBJECTID=<RMD' || j || file || '>;'
  118.         settings=shadowID || objectID
  119.         res=SysCreateObject('WPShadow',,
  120.             'DummyText',,
  121.             RMDFolderID,,
  122.             settings,,
  123.             'FAIL')
  124.     END
  125. END
  126.  
  127. EXIT
  128.