On 30/06/2022 4:22 am, Bernd Oppolzer wrote:

This is an old OS/2 REXX program (from the 1990s, IIRC),
used to traverse a directory tree recursively and issue a command in every subdirectory found:


/* rexx */

arg command

call RxFuncAdd "SysLoadFuncs", "REXXUTIL", "SysLoadFuncs"
call SysLoadFuncs

dir = directory()
if right(dir,1) = "\" then
   dir = left(dir, length(dir) - 1)

call tree dir, command

x = directory(dir)

exit


tree: procedure

   arg dir, command

   say "*** Verzeichnis in Bearbeitung: "dir" ***"

   x = directory(dir)

   command

   rc = SysFileTree("*.*", verz, "D")
   do i = 1 to verz.0
      dir = word(verz.i, 5)
      call tree dir, command
   end

   return


you may notice the recursive call of the procedure "tree".

I don't see any justification for your REXX bashing;
it's just another flavor of scripting language, which allows to do great things,
once you manage to use it.

Sorry Brend, but I don't consider that snippet to be great! It's a perfect example of flabby, verbose REXX code. The only justification for using REXX is that you personally favor the language. Python is far more succinct.

|for| |root, dirs, files ||in| |os.walk(path_of_the_directory):|
|||for| |i ||in| |files:|
|||print||(os.path.join(root, i))|


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to