home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / drives.cmd < prev    next >
OS/2 REXX Batch file  |  1995-01-28  |  4KB  |  56 lines

  1. /* A lovely little program by Dave Goran */
  2.  
  3. /*-----------------------------------------------------------------*\
  4. |  TEST132.CMD - Set all root directories to TREE and subs to ICON  |
  5. \*-----------------------------------------------------------------*/
  6. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'            
  7. call SysLoadFuncs                   /* Register REXXUTIL.DLL */      
  8.                                                                      
  9. /*---------------------------------*\                                
  10. |  Build string with drive letters  |                                
  11. \*---------------------------------*/                                
  12. drive_list = SysDriveMap( 'C', 'LOCAL' )                             
  13.                                                                      
  14. /*--------------------*\                                             
  15. |  Process each drive  |                                             
  16. \*--------------------*/                                             
  17. do drive_number = 1 to WORDS( drive_list )                           
  18.   drive_letter_colon = WORD( drive_list, drive_number )              
  19.                                                                      
  20. /*----------------------------*\                             
  21. |  Build array of directories  |                             
  22. \*----------------------------*/                             
  23. call SysFileTree drive_letter_colon || '\*.*',,              
  24.                  'directory_stem',,                          
  25.                  'DO'            /* directory names only */  
  26.                                                              
  27. /*---------------------------------*\                        
  28. |  Set root directory to TREE view  |                        
  29. \*---------------------------------*/                        
  30. say 'Processing: 'drive_letter_colon
  31. call SysSetObjectdata drive_letter_colon, 'DEFAULTVIEW=TREE;'
  32. if result <> 1 then                                          
  33.    do                                                        
  34.       say 'Unable to set '       ||,                         
  35.           drive_letter           ||,                         
  36.           ' to tree view'                                    
  37.    end                                                       
  38.                                                              
  39. /*---------------------------------*\                        
  40. |  Set subdirectories to ICON view  |                        
  41. \*---------------------------------*/                          
  42.   if directory_stem.0 > 0 then                                   
  43.       do sub_number = 1 to directory_stem.0                       
  44.          directory_name = directory_stem.sub_number               
  45.          say 'Processing: 'directory_name
  46.          call SysSetObjectdata directory_name, 'DEFAULTVIEW=ICON;'
  47.          if RESULT <> 1 then                                      
  48.             do                                                    
  49.                say 'Unable to set ' ||,                           
  50.                    directory_name   ||,                           
  51.                    ' to tree view'                                
  52.             end                                                   
  53.       end                                                     
  54. end                                                                  
  55. exit                                                              
  56.