home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxlb.zip
/
SAMPLES
/
TRAVERSE.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-01-08
|
2KB
|
39 lines
/*****************************************************************************/
/* */
/* Traverse a tree of directories, starting at the current directory, */
/* issuing a specified command in each directory. */
/* */
/* Example: traverse erase *.bak */
/* */
/* Requires Personal REXX or REXXLIB (doscd, doschdir, dosdir, dosdirpos */
/* functions). */
/* */
/*****************************************************************************/
parse arg command
savecd = doscd()
directory = savecd
if right(directory,1) = '\' then
directory = left(directory, length(directory) - 1)
call tree directory, command
call doschdir savecd
exit
tree: procedure
parse arg directory, command
if directory = '' then
say '--> \'
else
say '-->' directory
call doschdir directory
command
name = dosdir(directory'\*.*','n','d','d')
position = dosdirpos()
do while name \= ''
if name \= '.' & name \= '..' then
call tree directory'\'name, command
name = dosdir(,'n','d','d',position)
position = dosdirpos()
end
return