Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mp_tree.sas File Reference

Recursively scans a directory tree to get all subfolders and content. More...

Go to the source code of this file.

Detailed Description

Usage:

%mp_tree(dir=/tmp, outds=work.tree)

Credits:

Roger Deangelis: https://communities.sas.com/t5/SAS-Programming/listing-all-files-within-a-directory-and-subdirectories/m-p/332616/highlight/true#M74887

Tom: https://communities.sas.com/t5/SAS-Programming/listing-all-files-of-all-types-from-all-subdirectories/m-p/334113/highlight/true#M75419

Parameters
dir=Directory to be scanned (default=/tmp)
outds=Dataset to create (default=work.mp_tree)
Returns
outds contains the following variables:
  • dir: a flag (1/0) to say whether it is a directory or not. This is not reliable - folders that you do not have permission to open will be flagged as directories.
  • ext: file extension
  • filename: file name
  • dirname: directory name
  • fullpath: directory + file name
Version
9.2

Definition in file mp_tree.sas.