home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 28 Fixes4x / 28-Fixes4x.zip / hpfsfp10.zip / dirfix.cmd next >
OS/2 REXX Batch file  |  1999-09-06  |  2KB  |  87 lines

  1. /*
  2. dirfix.cmd - reset archive attribute on directories
  3. Copyright 1999 by Chuck McKinnis,  Sandia Park, NM (USA)
  4. mckinnis@ibm.net
  5. */
  6.  
  7. Trace 'N'
  8.  
  9. Parse Upper Arg drives test .
  10.  
  11. If drives = 'TEST' Then
  12.    Parse Upper Arg test drives .
  13.  
  14. If Abbrev(test, 'TEST') Then
  15.    test = 1
  16. Else
  17.    test = 0
  18.  
  19. If drives = '' Then
  20.    Do
  21.       Say 'Report on and reset directory entries'
  22.       Say '   that have the archive bit set on'
  23.       Say ''
  24.       Say 'Usage - dirfix x: | all [test]'
  25.       Say '   test - just report the findings'
  26.       Return
  27.    End
  28.  
  29. Call Setup
  30.  
  31. If drives = 'ALL' Then
  32.    drives = SysDriveMap(, 'LOCAL')
  33. Else
  34.    If Lastpos(':', drives) <> Length(drives) Then
  35.       drives = drives || ':'
  36.  
  37. tst_attrib = '++***'
  38. chg_attrib = '-****'
  39.  
  40. if test Then
  41.    chg_attrib = '*****'
  42.  
  43. Do i = 1 To Words(drives)
  44.    Parse Value SysDriveInfo(Word(drives, i)) With drive free total . 
  45.    If free = total | free = '' | free = 0 Then
  46.       Iterate i
  47.    drive = drive || '\'
  48.    rc = SysFileTree(drive, 'dirs.', 'DSO', tst_attrib, chg_attrib)
  49.    If dirs.0 > 0 Then
  50.       Do i = 1 To dirs.0
  51.          Say 'Archive bit set on in' dirs.i
  52.       End
  53.    Else
  54.       Say 'No archive bits found set in directories on' drive
  55.    If \test Then
  56.       Do
  57.          If dirs.0 = 1 Then
  58.             Say dirs.0 'directory cleared on' drive
  59.          Else
  60.             Say dirs.0 'directories cleared on' drive
  61.       End
  62. End
  63. Call Cleanup
  64. Return
  65.  
  66. Cleanup:
  67.  Procedure Expose sysfuncs. 
  68.  Do i = 1 To sysfuncs.0
  69.     If sysfuncs.i <> '' Then
  70.        Call RxFuncDrop(sysfuncs.i)
  71.  End
  72.  Return
  73.  
  74. Setup:
  75.  Procedure Expose sysfuncs.
  76.  sysfuncs.1 = 'SysFileTree'
  77.  sysfuncs.2 = 'SysDriveMap'
  78.  sysfuncs.3 = 'SysDriveInfo'
  79.  sysfuncs.0 = 3
  80.  Do i = 1 To sysfuncs.0
  81.     If RxFuncQuery(sysfuncs.i) Then
  82.        Call RxFuncAdd sysfuncs.i, 'RexxUtil', sysfuncs.i
  83.     Else
  84.        sysfuncs.i = ''
  85.  End
  86.  Return
  87.