(view source code of locase.cmd as plain text)
/* Rename file(s) to all lower case */
/* Written by Rob van der Woude */
/* http://www.robvanderwoude.com */
/* Parse command line parameters */
lfn = ""
parse upper arg '"'filespec'"' dummy"/"option
if filespec = "" then do
parse upper arg filespec dummy"/"option
end
else do
/* Long file name detected */
lfn = '"'
end
if dummy <> "" then call Syntax
if filespec = "" then call Syntax
if option <> "" then do
option = left( option, 1 )
if option <> "S" then call Syntax
end
/* Initialize RexxUtil */
if RxFuncQuery( SysLoadFuncs ) = 1 then do
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
end
call SysFileTree filespec, "file.", "FO"||option
if file.0 = 0 then call Syntax "FileNotFound"
do i = 1 to file.0
newname = translate( filespec( "N", file.i ), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
say "1B"X||"[1;1H"||"1B"X||"[K"||newname||"0D0A"X||"1B"X||"[K"||"1B"X||"[1A"
address CMD "@CMD /C REN "||lfn||file.i||lfn||" "||lfn||newname||lfn
end
EXIT
Syntax: procedure expose filespec
say
if arg( 1 ) = "FileNotFound" then do
say "File not found: "||filespec
end
else do
say "LoCase - convert file names to all lower case"
say "Written by Rob van der Woude"
say "http://www.robvanderwoude.com"
end
say
say "Usage: LOCASE <filespec> [ /Subdirectories ]"
exit
return
page last modified: 2024-04-16; loaded in 0.0063 seconds