![]() |
Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
|
Returns all files and subdirectories within a specified parent. More...
Go to the source code of this file.
When used with getattrs=NO, is not OS specific (uses dopen / dread).
If getattrs=YES then the doptname / foptname functions are used to scan all properties - any characters that are not valid in a SAS name (v7) are simply stripped, and the table is transposed so theat each property is a column and there is one file per row. An attempt is made to get all properties whether a file or folder, but some files/folders cannot be accessed, and so not all properties can / will be populated.
Credit for the rename approach: https://communities.sas.com/t5/SAS-Programming/SAS-Function-to-convert-string-to-Legal-SAS-Name/m-p/27375/highlight/true#M5003
usage:
%mp_dirlist(path=/some/location,outds=myTable) %mp_dirlist(outds=cwdfileprops, getattrs=YES) %mp_dirlist(fref=MYFREF)
path= | for which to return contents |
fref= | Provide a DISK engine fileref as an alternative to PATH |
outds= | the output dataset to create |
getattrs= | YES/NO (default=NO). Uses doptname and foptname to return all attributes for each file / folder. |
getattrs=
is used.Definition in file mp_dirlist.sas.