LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 May 2000 10:49:48 +0200
Reply-To:     Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject:      Re: Create a directory from SAS
Comments: To: Benjamin Guralnik <guralnik@BEZEQINT.NET>
Content-Type: text/plain


Regarding automatical creation of subdirectories, if possible a whole path at once, I am rather sure that creating more than one at a time is not possible. You should indeed issue separate commands to do so. However, you actually may say { MD sub1\sub2 } if sub1 already exists. Furthermore, if a directory already exists and you don't test for that (in some way) an MD command doesn't do any harm either (except for some error report). However, a directory name specified already may exist as a file name. In that case an MD command doesn't do any harm either, but the desired directory can not be created, unless the file is renamed or (re)moved.

A very quick way for testing the existence of a subdirectory in DOS is: IF EXIST SubdPath\NUL ECHO This subdirectory or complete path exists However, I've noticed years ago already that this only works correctly on local drives, not on some network drives. So I wrote (compiled) batch files for testing the existence of some name as a file or directory, using attemps to create a dummy file in a directory. These work correctly on all kinds of drives, AFAIK. I have them somewhere at home. If you are interested to use them, tell me. On the other hand there may be other similar freeware DOS utilities available.

Regards - Jim. -- Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070 senior statistician, P.O. Box 1 fax. +31 412 407 080 head IT department 5350 AA BERGHEM IMRO TRAMARKO: a CRO the Netherlands in clinical research

It is my job to keep my computer at work, but its job is to reveal my work.

> -----Original Message----- > From: Benjamin Guralnik [SMTP:guralnik@BEZEQINT.NET] > Sent: Sunday, May 21, 2000 11:13 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Create a directory from SAS > > Hello SAS-L, > > Is anybody aware of any convenient method of creating a directory from a > SAS > program? I'm writing a setup utility that is supposed to create a new > directory, but unfortunately, the "mkdir" DOS command can create only one > directory at a time, despite its syntax specification: > > MKDIR [drive:]path > MD [drive]path > > That is, to create c:\newdir\newdir2 (assuming that both does not yet > exist), you'd have to submit: > MD c:\newdir > MD c:\newdir\newdir2 > > Now, the question is, how would you do this from SAS. CALL SYSTEM("dos > command") seems fine for this task. You split the string containing the > path > at every concurrency of a backslash "\", then check to see whether the > path > exists up to this point, and create it if it doesn't. > > The problem is, I haven't found yet a way to check the DOSERROR or > DOSEXITCODE of a "cd <path>" command. Or is there any elegant > "exists(filename|pathname)" SCL approach? > > Moreover, I'd like that this newly created directory would be > automatically > assigned at startup. Now I have to tell the user to go to "Libraries", > select the appropriate lib, and check the "assign at startup" option under > Modify Library. Is there any way to do this programmatically? > > Thanks in advance, > Benjamin

Back to: Top of message | Previous page | Main SAS-L page