Am looking for some (efficient) code to determine the size of a directory / folder in Windows XP using SAS 9.1.3.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
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.