home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Collection - Online Library - January 1996 / CKITOS2196.ISO / diskette / gg244043.dsk / unc.dsk / LS30UTIL / CPYDACP.CMD < prev    next >
OS/2 REXX Batch file  |  1993-02-10  |  4KB  |  106 lines

  1. /*******************************************************************/
  2. /* CPYDACP.CMD                                                     */
  3. /*                                                                 */
  4. /* Copy directory related Access Control Profiles.                 */
  5. /* The Access Control Profiles from the source directory are       */
  6. /* copied and applied to the destination directory.                */
  7. /* The arguments are:                                              */
  8. /*                                                                 */
  9. /*  option          The option can either be                       */
  10. /*                  D Only the directory Access Control Profiles   */
  11. /*                    is copyed to the destination directory       */
  12. /*                                                                 */
  13. /*                  R The directory Access Control Profiles of     */
  14. /*                    the sourcer directory and all subdirectories */
  15. /*                    are copied in recursive order. The realtive  */
  16. /*                    subdirectory positions will be preserved     */
  17. /*                                                                 */
  18. /*  sourceDir       The source directory of the operation          */
  19. /*                                                                 */
  20. /*  destinationDir  The destination directory of the operation     */
  21. /*                                                                 */
  22. /*******************************************************************/
  23.  
  24. parse upper arg option sourceDir destinationDir
  25.  
  26. call LoadFuncs; /* Load DLL utility functions */
  27.  
  28. /* Must have all arguments with values */
  29. if ((option='') | (sourceDir='') | (destinationDir='')) then do
  30.  call dspHelp;
  31.  exit 9
  32. end
  33.  
  34. /* If anything else than 'D' and 'R' mae it a 'D' */
  35. if ((option<>'D') & (option<>'R')) then
  36.  option = 'D'
  37.  
  38. if option = 'D' then do
  39.  file.0 = 1
  40.  file.1 = sourceDir
  41. end
  42.  
  43. if option = 'R' then
  44.  call SysFileTree sourceDir||'\*.*', 'file', 'SDO'
  45.  
  46. if file.0 = 0 then do
  47.  call DropFuncs
  48.  exit 9
  49. end
  50.  
  51. /* Have the directory specifications. Ready to do ACP copy */
  52. do i=1 to file.0
  53.  if length(sourceDir) = length(file.i) then do
  54.   rc = CopyDirAcls(file.i, destinationDir)
  55.  end
  56.  else do
  57.   rc=CopyDirAcls(file.i, destinationDir||substr(file.i,length(sourcepath)))
  58.  end
  59.  if rc <> '0' then do
  60.   say
  61.   say 'CopyDirAcls() returned: ' rc
  62.   say 'Source Directory:' file.i
  63.  end
  64. end
  65.  
  66. call DropFuncs
  67. exit 0
  68.  
  69. /*************************************************************/
  70. /* Load DLL Functions                                        */
  71. /*************************************************************/
  72. LoadFuncs:
  73.  
  74.  /* Load REXXUTIL.DLL functions */
  75.  call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  76.  call SysLoadFuncs
  77.  
  78.  /* Load LS30UT.DLL functions */
  79.  call RxFuncAdd 'LoadLs30utFuncs', 'LS30UT', 'LoadLs30utFuncs'
  80.  call LoadLs30utFuncs
  81.  
  82. return
  83.  
  84. /*************************************************************/
  85. /* Drop DLL Functions                                        */
  86. /*************************************************************/
  87. DropFuncs:
  88.  
  89.  /* Drop LS30UT.DLL functions */
  90.  call DropLs30utFuncs
  91.  
  92.  /* Drop REXXUTIL.DLL functions */
  93.  call SysDropFuncs
  94.  
  95. return
  96.  
  97. /*************************************************************/
  98. /* Display help                                              */
  99. /*************************************************************/
  100. dspHelp:
  101.  
  102.   say 'Use CPYDACP [D|R] sourceDir destinationDir'
  103.  
  104. return
  105.  
  106.