home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
netdor3.zip
/
DISK_12
/
IMAGE11.ZIP
/
ADMTOOLS
/
QFOLDER.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-08-20
|
3KB
|
73 lines
/*****************************************************************************
* QFOLDER - Determine directory corresponding to a folder *
* Tom Bridgman (CORE at WATSON) *
*****************************************************************************
* Licensed Materials-Property of IBM *
* 5604-472 (c) Copyright IBM Corporation, 1993 *
* All rights reserved. *
* US Government Users Restricted Rights - *
* Use, duplication or disclosure restricted *
* by GSA ADP Schedule Contract with IBM Corp. *
****************************************************************************/
trace 'O'
signal on syntax
signal on novalue
parse arg FldName, Root
parse source . How Me
if FldName = '?'
then signal Tell
call RxFuncAdd 'SYSLOADFUNCS', 'REXXUTIL', 'SYSLOADFUNCS'
SynRef = 'SYSLOADFUNCS'
call SysLoadFuncs
drop SynRef
Cmd = (How = 'COMMAND')
if pos('\', Me) > 0
then do
MyPath = left(Me, max(3, lastpos('\', Me)-1))
call setlocal
call value 'PATH', MyPath';'value('PATH',,'OS2ENVIRONMENT'), 'OS2ENVIRONMENT'
end
FldPath = ''
SynRef = 'QDESKTOP'
if Root = ''
then Root = 'QDESKTOP'()
drop SynRef
if right(Root, 1) <> '\'
then Root = Root'\'
FldName = strip(strip(FldName),,'"')
if Root <> ''
then do
call SysFileTree Root'*', 'DIRS.', 'DSO'
do I = 1 to Dirs.0 while FldPath = ''
if SysGetEA(Dirs.I, '.LONGNAME', 'NAME') = 0
then if substr(Name, 5) == FldName
then FldPath = Dirs.I
end
end
if Cmd
then if FldPath = ''
then say 'The directory for "'FldName'" could not be determined.'
else say 'The "'FldName'" directory is "'FldPath'".'
return FldPath
Tell:
say 'QFOLDER foldername'
say 'Returns the name of the directory corresponding to the specified folder name.'
say 'Note that folder names are case sensitive, and spaces in names are significant.'
say 'The foldername can be enclosed in quotes, if desired.'
exit 0
Syntax:
signal off novalue
select
when SynRef = 'QDESKTOP'
then say 'QDESKTOP.CMD has to be in the PATH or the same directory as' Me'.'
otherwise
say 'Syntax error' rc '('errortext(rc)') raised in line' sigl'.'
end
exit 2
Novalue:
say 'Novalue error ('condition('D')') raised in line' sigl'.'
exit 2