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

  1. /*******************************************************************/
  2. /* CPYAACP.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. /*  alias           The directory alias, from with the source      */
  19. /*                  directory is extracted.                        */
  20. /*                                                                 */
  21. /*  destDir         The destination directory of the operation     */
  22. /*                                                                 */
  23. /*******************************************************************/
  24.  
  25. parse upper arg option alias destDir
  26.  
  27. call LoadFuncs; /* Load DLL utility functions */
  28.  
  29. /* Must have all arguments with values */
  30. if ((option='') | (alias='') | (destDir='')) then do
  31.  call dspHelp;
  32.  exit 9
  33. end
  34.  
  35. /* If anything else than 'D' and 'R' make it a 'D' */
  36. if ((option<>'D') & (option<>'R')) then
  37.  option = 'D'
  38.  
  39. /* Must have access to domain controller name */
  40. parse value GetDCName() with rc dcName
  41.  
  42. if rc <> '0' then do
  43.  say 'Could not obtain Domain Controller name'
  44.  exit 9
  45. end
  46.  
  47. if dcName = '' then do
  48.  say 'Could not obtain Domain Controller name'
  49.  exit 9
  50. end
  51.  
  52. /* Get alias directory */
  53. parse value QueryDirAliasPath(dcName, alias) with rc aliaspath
  54.  
  55. if ( (rc <> '0') & (aliaspath <> '') ) then do
  56.  say 'Could not obtain alias directory'
  57.  exit 9
  58. end
  59.  
  60. if option = 'D' then do
  61.  file.0 = 1
  62.  file.1 = aliaspath
  63. end
  64.  
  65. if option = 'R' then
  66.  call SysFileTree aliaspath||'\*.*', 'file', 'SDO'
  67.  
  68. if file.0 = 0 then do
  69.  call DropFuncs
  70.  exit 9
  71. end
  72.  
  73. /* Have the directory specifications. Ready to do ACP copy */
  74. do i=1 to file.0
  75.  if length(aliaspath) = length(file.i) then do
  76.   rc=CopyDirAcls(file.i, destDir)
  77.  end
  78.  else do
  79.   rc=CopyDirAcls(file.i, destDir||substr(file.i,length(aliaspath)))
  80.  end
  81.  if rc <> '0' then do
  82.   say
  83.   say 'CopyDirAcls() returned: ' rc
  84.   say 'Source Directory:' file.i
  85.  end
  86. end
  87.  
  88. call DropFuncs
  89. exit 0
  90.  
  91. /*************************************************************/
  92. /* Load DLL Functions                                        */
  93. /*************************************************************/
  94. LoadFuncs:
  95.  
  96.  /* Load REXXUTIL.DLL functions */
  97.  call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  98.  call SysLoadFuncs
  99.  
  100.  /* Load LS30UT.DLL functions */
  101.  call RxFuncAdd 'LoadLs30utFuncs', 'LS30UT', 'LoadLs30utFuncs'
  102.  call LoadLs30utFuncs
  103.  
  104. return
  105.  
  106. /*************************************************************/
  107. /* Drop DLL Functions                                        */
  108. /*************************************************************/
  109. DropFuncs:
  110.  
  111.  /* Drop LS30UT.DLL functions */
  112.  call DropLs30utFuncs
  113.  
  114.  /* Drop REXXUTIL.DLL functions */
  115.  call SysDropFuncs
  116.  
  117. return
  118.  
  119. /*************************************************************/
  120. /* Display help                                              */
  121. /*************************************************************/
  122. dspHelp:
  123.  
  124.   say 'Use CPYAACP [D|R] alias destiationDir'
  125.  
  126. return
  127.  
  128.