home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / utilities / abcdir.lha / Util / DIR / rexx / RenameOther.rexx < prev   
OS/2 REXX Batch file  |  1993-06-30  |  2KB  |  66 lines

  1. /* example of Rename */
  2.  
  3. OPTIONS RESULTS
  4. OPTIONS FAILAT 20
  5. SIGNAL ON FAILURE
  6.     
  7. ADDRESS MEGAD
  8. dbug  
  9.  
  10. /* First, we need to make sure that the items are sorted by Name */
  11. "MenuCheck 'show,sort on,name' Check"
  12. directory  = ARG(1)
  13. if directory = '' then exit
  14. /******************************************************************************* 
  15. The directory argument can be sent in one of two ways
  16. Selected Directory in MegaD window
  17.     ARexx Gadget Program Control should have only the below two items checked
  18.         Skip selected files
  19.         Skip .info files
  20.     and the Path and Program name should be the correct path to this script.
  21.     This will require the user to select at least one directory to rename
  22.     every other file to have an underscore in front of it.
  23. User Input required
  24.     ARexx Gadget Program Control should have only the below five items checked
  25.         Skip select4d directories
  26.         Skip selected files
  27.         work without selected items
  28.         skip .info files
  29.         Query for 'Flags to add'
  30.     and the Path and Program name should be the correct path to this script.
  31.     This method will require a valid Path to the correct directory to
  32.     be typed by the user.
  33. *******************************************************************************/
  34.     
  35. CloseWindows    /* close any open windows */
  36. Mark directory     /* open the ram disk */
  37. IF RESULT = '' then exit
  38. SelectAll        /* select everything */
  39.  
  40. /* disable directory sorting or we will be rename files renamed once before */
  41. "MenuCheck 'show,sort on,none' Check"
  42.  
  43. DO FOREVER
  44.     NextItem Filename
  45.     if result = "" then leave
  46.     ELSE DO
  47.         name = '_' || result
  48.         Rename name  /* Rename will unselect the first selected item */
  49.         END
  50.     /* skip the next selected item */
  51.     NextItem Filename clear /* unselect the next item too */
  52.     IF RESULT = "" then leave
  53.     END
  54.  
  55. /* re-enable the sorting on Name */
  56. "MenuCheck 'show,sort on,name' Check"
  57. /* force and update of the window */
  58. "Menu 'show,Reset All'"
  59.  
  60. exit
  61.  
  62. failure:
  63.     if RC ~= 0 then say "Script Failed, RC = " RC
  64.     exit
  65.  
  66.