home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
REXMENU2.ZIP
/
CDMENU.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-10-27
|
3KB
|
87 lines
/* CDMenu.cmd: Use RexxMenu to move to interactively move to different
* different directories and drives.
*/
/* ADD RexxMenu function support from the RexxMenu.dll */
if 1 = RxFuncQuery('RexxMenu') then
CALL RxFuncAdd 'RexxMenu', 'RexxMenu', 'RexxMenu'
/* Also uses SysFileTree to read directory */
CALL RxFuncAdd 'SysFileTree', 'rexxutil', 'SysFileTree'
CALL RxFuncAdd 'SysDriveMap', 'rexxutil', 'SysDriveMap'
do until 0 = COMPARE(DirChoice,'')
CurDirSpec = DIRECTORY()
if \(LENGTH(CurDirSpec) = 3) then CurDirSpec = INSERT(CurDirSpec,'\')
/* prepare new temporary file to save to */
TempFile = INSERT(CurDirSpec,'CDMnLst.tmp')
'@if exist' TempFile 'del' TempFile
/* If this is not the root directory then prepare a double-dot entry */
if \(LENGTH(CurDirSpec) = 3) then do
'@echo' INSERT(CurDirSpec,'..') '>>' TempFile
curdir = DIRECTORY()
'@echo Full Name =' DIRECTORY('..') '>>' TempFile
call DIRECTORY curdir
end /* Do */
/* Add the current directory, just because I feel like it */
'@echo' INSERT(CurDirSpec,'.') '>>' TempFile
'@echo Full Name =' DIRECTORY() '>>' TempFile
call SysFileTree "*", 'FileList' , 'OD'
if \(FileList.0 = 0) then do
/* Build temporary file to hold list of subdirectories */
i = 0
do while i < FileList.0
i = i + 1
'@echo' FileList.i '>>' TempFile
'@echo Full Name =' FileList.i '>>' TempFile
end /* do */
end /* Do */
DROP FileList.
/* Add options for all the drives */
curdir = DIRECTORY()
DriveMap = SysDriveMap()
i = 1
do until DriveLetter = '.'
DriveLetter = SUBSTR(DriveMap,i,1,'.')
if \(DriveLetter = '.') then do
'@echo' INSERT(CurDirSpec,INSERT(DriveLetter,':')) '>>' TempFile
'@echo Full Name =' DIRECTORY(INSERT(DriveLetter,':')) '>>' TempFile
end /* Do */
i = i + 3
end /* do */
call DIRECTORY curdir
/* Let user choose Directory to move to */
DirChoice = RexxMenu(TempFile,'/Com','Full Name = ',,
'/Pre',CurDirSpec,,
'/Prompt','CD' CurDirSpec,,
'/Esc')
/* Do not need the temporary file anymore */
'@del' TempFile
if \ 0 = COMPARE(DirChoice,'') then do
if LENGTH(DirChoice) = 2 & SUBSTR(DirChoice,2,1) = ':' then do
/* change to the selected drive letter */
call DIRECTORY DirChoice
end /* Do */
else do
/* May need quotes around directory in case there are spaces */
QuoteDirChoice = INSERT(INSERT('"',DirChoice),'"')
call DIRECTORY DirChoice
end /* Do */
end /* Do */
end /* do */
'@cls'
EXIT