The only reason why your Python code is shorter is because you use
the builtin os.walk method to walk through the directory recursively.
A similar method could have been used in my REXX example, too,
but I wanted a command to be issued in every subdirectory
when walking through the tree,
so I had to do the recursive directory walk myself, using the recursive call
to the tree procedure. This is what makes my coding longer,
but this is not due to the REXX language. Be fair.

To call this verbose is simply wrong, and you are missing the point completely; please show me how your Python solution looks, if you also walk the directory tree
by yourself and issue a command given as a parameter at every subdirectory
and not only print the name.

but I don't really want to argue on this ... this seems like a waste ot time.

I use the tools I have at hand ... and I didn't have Python in 1998 on my OS/2 boxes. This has nothing to do with personal favor; I use the tools which make the most
sense for me, given my knowledge or my personal skills (which can of course
change or improve over time).

Earlier in a similar thread I told you or other posters how easy it is to append
small pieces of information every 15 minutes to a file using IBM's C
and still having a large blocksize etc. ... and how I would support
the simultaneous update and the reporting. The thread degraded into a
discussion about started tasks and how to implement the operator commands
to control the STCs using REXX or other languages ... again: what a waste of time. For appending information to a file every 15 minutes, I would create a batch job which is started every 15 minutes, controlled by UC4 or cron or whatever you have ... and which terminates after some milliseconds. No need for a started task,
which is idle most of the time.

I miss sometimes a certain cost sensitivity with the discussions here in IBM-MAIN,
but this should be part of our profession.

Kind regards

Bernd



Am 29.06.2022 um 23:24 schrieb David Crayford:
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

----------------------------------------------------------------------
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