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 (November 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 4 Nov 2010 19:16:19 -0400
Reply-To:   Nat Wooding <nathani@VERIZON.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <nathani@VERIZON.NET>
Subject:   Re: Can SAS pull info about MS Window folders?
In-Reply-To:   <AANLkTinTyxVyBAvUH6G-2=M9J7wqaWMdWkH-3QUy9FMO@mail.gmail.com>
Content-Type:   text/plain; charset="US-ASCII"

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 >


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