开发者

How can SAS be used to determine the size of a directory in MBs (Windows)?

开发者 https://www.devze.com 2023-03-12 05:56 出处:网络
Am looking for some (efficient) code to determine the size of a di开发者_开发技巧rectory / folder in Windows XP using SAS 9.1.3.If you are not constrained by the SAS NOXCMD option (such as SAS Enterpr

Am looking for some (efficient) code to determine the size of a di开发者_开发技巧rectory / folder in Windows XP using SAS 9.1.3.


If you are not constrained by the SAS NOXCMD option (such as SAS Enterprise Guide hitting a SASApp - Workspace Server in its default configuration where the administrator has not opened it up) then I would suggest downloading and using the Microsoft Sysinternals Disk Usage (DU) tool via a SAS data null step using a pipe filename. Here is some sample SAS code:

filename du pipe "du -q c:\SAS\EBIEDIEG\Lev1\SASApp";
data work.diskusage;
infile du;
input @;
put _infile_;
if ( _infile_ =: 'Size:' ) then do;
    sizeInBytes = input(scan(_infile_,2,' '), comma32.);
    output;
end;
input;
run;

Microsoft Sysinternals Disk Usage (DU) is similar to the familiar UNIX du command. You can download Sysinternals DU and review the documentation at http://technet.microsoft.com/en-au/sysinternals/bb896651 It has a -l parameter so you can specify how deep it should go.

If you are constrained by the NOXCMD option then you could use a series of loops using the SAS DOPEN/DREAD/FILENAME/FOPEN/FINFO/FCLOSE/DCLOSE functions to manually walk the directory tree and add up the file sizes. It will involve much more code but should run in a NOXCMD environment. If you want to use this method then a good starting point will be the SAS documentation for DOPEN at http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000209538.htm where you will also be able to find the documentation and examples for the other functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消