Date: Tue, 10 Aug 2004 01:36:29 -0400
Reply-To: Glenn Heagerty <gheagerty@EARTHLINK.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Glenn Heagerty <gheagerty@EARTHLINK.NET>
Subject: Re: Counting files in Folders
In-Reply-To: <200408092016.1bUn864WZ3NZFjK0@condor>
Content-Type: text/plain; charset=us-ascii; format=flowed
DH,
A little more experimenting showed that the command below run from a Unix
terminal yielded the same results without having to use a data step.
ls -1 /my/proj/folder/* | grep -c .sas
The grep command takes the output from the ls command and counts the number of
lines containing '.sas'. Don't know the equivalent for DOS.
Glenn
Hey x x,
Here's a data step that counted the number of SAS programs (.sas extension) in a
project folder of mine. It utilizes a pipe to get the results of the Unix ls
command into a data step where it counts the number of occurrences of files
ending w/ .sas:
filename filelist pipe "ls -F1 /my/proj/folder/*";
data files;
infile filelist end=last;
input;
if scan(_infile_, -1, '.') eq 'sas' then count + 1;
if last then put 'SAS Programs:' count comma10.;
run;
It looks like the equivalent DOS command is: dir /A-D-H-S /S \my\proj\folder.
Just modify the code above to use your top folder, the relevant listing command
with options, and the data step to look for the file extension(s) you want.
HTH,
Glenn
x x wrote:
> Hi all,
>
> Perhaps this is not a SAS domain question but I hope
> SAS can solve it and that you can help me:
>
> For a comparison report, I need to count the number of
> reports produced by a SAS program that goes into
> thousands of lines.
>
> The program is run 4 times a year for the last 6
> years.
>
> The program uses ODS output procedures to produce
> hundreds and hundreds of documents in folders in some
> cases 6 deep.
>
> Perhaps it would have been easy to put a counter in
> the program initially but I dont have all the
> programs.
> I only have the last one and it takes 5 hours to run.
>
> Is there a quick way of just counting those documents
> in each folder?
>
> Any help will be appreciated.
>
> Regards
>
> DH
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>