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 (February 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 23 Feb 2005 15:14:26 -0800
Reply-To:   cassell.david@EPAMAIL.EPA.GOV
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject:   Re: Scan files from multiple directories
In-Reply-To:   <>
Content-type:   text/plain; charset=US-ASCII

enstrophy <> wrote: > I'm attempting to read files with known extensions from multiple > directories under windows. For example, I have several *.dat files > under folders named folder_*, i.e., > > c:/folder_01 > a.dat > b.dat > > c:/folder_211 > 101.dat > a2.dat > > Unlike in unix, the following expression: > > filename myfiles("c:/folder_*/*.dat") > > is not recognized by the windows xp shell. > Since the number of folders will grow over time, > it is not a good idea to hard code the folder names > in the code. I wonder if anyone knows of a simple > solution to this problem? Many thanks.

I see that Richard has already provided an excellent response. (As always.) Take his advice.

And remember that win32 is not unix. I would have recommended using Perl to do this, in much the same way, providing a pipe into the DATA step. In ActiveState Perl for win32, the easiest way to get this sort of wildcard expansion in filename and directory listings thrown in at the command line (where it is still subject to the whims of the OS) is the use of the File::DosGlob module, or Jenda's G module (

Now then, let me ask a question. Why are you using this directory and file structure? It seems to be rather sub-optimal, and is likely to continue to cause you more headaches as time (and hard drive space) advances. Changing your storage structure could make your work easier in future. Not to mention how awkward it will be to do any file updates, file maintenance, data QA, ....

David -- David Cassell, CSC Senior computing specialist mathematical statistician

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