Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for upcase.cmd

(view source code of upcase.cmd as plain text)

  1. /* Rename file(s) to all lower case */
  2. /* Written by Rob van der Woude     */
  3. /* http://www.robvanderwoude.com    */
  4.  
  5. /* Parse command line parameters */
  6. parse upper arg filespec dummy"/"option
  7. if dummy   <> "" then call Syntax
  8. if filespec = "" then call Syntax
  9. if option <> "" then do
  10. 	option = left( option, 1 )
  11. 	if option <> "S" then call Syntax
  12. end
  13.  
  14. /* Initialize RexxUtil */
  15. if RxFuncQuery( SysLoadFuncs ) = 1 then do
  16. 	call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  17. 	call SysLoadFuncs
  18. end
  19.  
  20. call SysFileTree filespec, "file.", "FO"||option
  21. if file.0 = 0 then call Syntax "FileNotFound"
  22. do i = 1 to file.0
  23. 	newname = translate( filespec( "N", file.i ) )
  24. 	say "1B"X||"[1;1H"||"1B"X||"[K"||newname||"0D0A"X||"1B"X||"[K"||"1B"X||"[1A"
  25. 	address CMD "@CMD /C REN "||file.i||" "||newname
  26. end
  27. EXIT
  28.  
  29.  
  30. Syntax: procedure expose filespec
  31. 	say
  32. 	if arg( 1 ) = "FileNotFound" then do
  33. 		say "File not found: "||filespec
  34. 	end
  35. 	else do
  36. 		say "UpCase - convert file names to all uppercase"
  37. 		say "Written by Rob van der Woude"
  38. 		say "http://www.robvanderwoude.com"
  39.  
  40. 	end
  41. 	say
  42. 	say "Usage:  UPCASE  <filespec>  [ /Subdirectories ]"
  43. 	exit
  44. return
  45.  

page last modified: 2024-04-16; loaded in 0.0055 seconds