sasjs folder command allows users to manage logical SAS Viya Folders (the kind that appear in SAS Drive). These are not to be confused with physical (filesystem) directories. The Viya Folder tree is actually stored in a Postgres Database.
It is useful to be able to create and delete folders as part of CI/CD, for instance when tearing down part of an environment in order to rebuild it.
Before using this command, you will need to install the SASJS CLI and add a deployment target.
sasjs folder <action> [additional arguments]
Additional arguments include:
-t) - the target environment in which to create the SAS Folder. If not specified, the first target will be used instead. The target can exist either in the local project configuration or in the global .sasjsrc file.
sasjs folder list¶
Used to list first level children folders of given folder.
sasjs folder list <folderpath> -t target
sasjs folder list /Public -t myTarget
sasjs folder create¶
Used to create a new SAS folder. Will fail if the folder already exists. If the
-f flag is used, a new folder will be forcibly created (ie, if there is an existing one, it will be deleted).
sasjs folder create <folderpath> -t target -f
sasjs folder create /Public/new/folder -t myTarget
sasjs folder delete¶
Used to delete an existing SAS Folder. To avoid the overhead with recursively deleting folders and content, the
delete command actually moves the requisite folder into the Recycle Bin. This makes it very fast, as well as reversable.
sasjs folder delete <folderpath> -t target
sasjs folder delete /Public/new/folder -t myTarget
sasjs folder move¶
Moves an existing folder to a new location. It behaves similarly to the Unix
targetpath is an existing folder, the folder will be moved underneath
targetpath does not exist, the folder is moved and renamed, inside the parent folder. See examples below.
sasjs folder move <folderpath> <targetpath>
sasjs folder move /Public/old/folder /Public -t myTarget
folder2 leaving it in same directory
sasjs folder move /Public/old/folder /Public/old/folder2 -t myTarget
/Public and renaming to
Reason for rename -
/Public/folder2 does not exist.
sasjs folder move /Public/old/folder /Public/folder2 -t myTarget