TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: JIM TANNER
from: DAVE NAVARRO
date: 1995-05-23 14:57:00
subject: MKDIR

To: JIM TANNER
Subject: MKDIR
JT>    Is MKDIR capable of making "nested" directories as in:
JT>    CHDRV "C"
JT>    MKDIR "C:\One\Two\Three"
Try the following code:
'Create nested directories
'by Dave Navarro, Jr.
DEFINT A-Z
MakeDir "c:\one\two\three"
SUB MakeDir(BYVAL Directory$) PUBLIC
  Directory$ = RTRIM$(Directory$, "\")               'trim trailing backslash
  Backslash = INSTR(Directory$, "\")
  DO
    IF Backslash THEN
      Tmp$ = LEFT$(Directory$, Backslash-1)
    ELSE
      Tmp$ = Directory$
    END IF
    IF LEN(DIR$(Tmp$+"\NUL")) = 0 THEN               'directory doesn't exist
      IF (Backslash = 1) OR (RIGHT$(Tmp$, 1) = ":") THEN 'drive doesn't exist
        EXIT SUB
      END IF
      MKDIR Tmp$                                     'create final directory
    END IF
    IF Backslash THEN
      Backslash = INSTR(Backslash+1, Directory$, "\")
    ELSE
      EXIT DO
    END IF
  LOOP
END SUB
--Dave
---
 * QMPro 1.53 * If I only had one more teragigadactylbyte..
--- WILDMAIL!/WC v4.12 
---------------
* Origin: Toast House * (314) 994-0312 * (1:100/560.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.