|
For those who might be interested, here is a sample set of code that uses a
pipe plus some parsing. At this point, I have long since forgotten from whom
I stole it.
Nat Wooding
** this uses a pipe to gather the names of files in a folder and reads a
single line from each
file. note the quotes in the filename statement;
filename ft33f001 pipe 'attrib "c:\*.txt" ' ;
data _null_;
infile ft33f001 truncover;
input @12 csvfile $256.;
infile dummy filevar=csvfile firstobs=122 length=l ;
input line $varying256. l ;
putlog 'NOTE: ' line=;
run;
*the following is an attempt at reading directory info;
FileName MyDir Pipe 'dir "C:\park" ' ;
DATA all_dir;
INFILE MyDir lrecl=300 truncover ;
INPUT @ ;
file print;
if index( _infile_ , '/' ) ;* get lines with dates;
if index( _infile_ , '<' ) then delete;* get rid of directories;
informat date mmddyy10. time time. ampm $2. Size comma15. Name $25.;
;
input date time ampm Size Name & ;
run;
proc print;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Joe
Matise
Sent: Thursday, November 04, 2010 6:14 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Can SAS pull info about MS Window folders?
The dos command
dir /s
will get you the total size of a folder and all of its contents; and if you
use it in a pipe, you can parse the piped output to determine each of the
subfolders' names.
-Joe
On Wed, Nov 3, 2010 at 12:41 PM, Andrea Zimmerman
<sassywench74va@gmail.com>wrote:
> I know how to use SAS to create folders inside other folders, or to see if
> a
> folder exists, but I'm wondering if SAS can come back with info on all the
> sub-folders within a specified folder.
>
> Specifically I'd like to get the size of the folder and all it's contents
> (what I see if I let the mouse hover over the folder name, or if I right
> click and select Properties)
>
> So I'd like to produce a SAS dataset with the name of all the subfolders
in
> a given folder, and the size of each of them.
>
> Thanks
>
> --
> Andrea W-Z
>
|