Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
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
[in]dir=(/tmp) Directory to be scanned
[out]outds=(work.mp_tree) Dataset to create
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.