home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rexxalgo.zip
/
TESTALGO
/
MakePath.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-08-25
|
3KB
|
89 lines
/* REXX **********************************************/
/* */
/* Program name: MakePath.CMD */
/* Function : Recursive directory path creating */
/* Syntax : Call MakePath _destPath */
/* Changes : No */
/* */
/* Made use of GREED. 28 Dec 1996 / 00:39:39 JRK */
/*****************************************************/
/* (C) Copyright Janosch R. Kowalczyk, 1996. */
/* All rights reserved. */
/*****************************************************/
Parse Source . calledAs .
If calledAs \= "COMMAND" Then
Parse Arg _destPath .
Else
Parse Arg _destPath, .
/*===============(Exception handling)================*/
Signal On Failure Name CLEARUP
Signal On Halt Name CLEARUP
Signal On Syntax Name CLEARUP
Signal On NotReady Name CLEARUP
/*===========(Initialize RexxUtil support)===========*/
If RxFuncQuery('SysLoadFuncs') Then Do
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs
End /* If RxFuncQuery... */
Say
Say Center( "( RECURSIVE DIRECTORY PATH CREATING )", 80, '*')
If _destPath = '' Then
_destPath = 'C:\TEST\MAKE\PATH\PROCEDUR\RECURSIV\NEW\TEST'
Call MakePath _destPath
Call LineOut , "Press any key to exit "
Call LineIn
/*================(End this program)================*/
Exit
CLEARUP:
Say
Say 'GREED001E - Break, Failure or Syntax Error'
Exit
/*=============( Recursive Path Creating )============*/
/* 16 */
/* Name.......: MakePath */
/* */
/* Function...: Create recursive directory path */
/* */
/* Call parm..: _destPath - directory path */
/* */
/* Returns....: formated string */
/* */
/* Syntax.....: */
/* _destPath = MakePath( _destPath ) */
/* */
/* Changes....: No */
/* */
/* Author.....: Janosch R. Kowalczyk */
/*====================================================*/
/*---------------(Create Directory Path)--------------*/
MakePath: Procedure
Arg _destPath
_destPath = Strip(_destPath,,'\')
If Pos('\', _destPath) = 0 Then Return _destPath
/*--------------( Check Directory Path )--------------*/
rc = SysFileTree( _destPath, fileList, 'DO' )
If fileList.0 = 0 Then Do
/*------------(Directory path not exists)-----------*/
Call MakePath SubStr(_destPath, 1, LastPos('\', _destPath))
rc = SysMkDir( _destPath )
If rc > 0 & rc \= 5 Then
Say 'Destination directory:' _destPath 'not created. RC=' rc
Else
Say _destPath 'successful created'
End
Return _destPath