sasjs folder¶
The 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.
Prerequisites¶
Before using this command, you will need to install the SASJS CLI and add a deployment target.
Syntax¶
Additional arguments include:
| Option | Alias | Sub commands | Description |
|---|---|---|---|
--target |
-t |
all | The target whose server holds the folders. SAS Viya only. Defaults to defaultTarget in sasjsconfig.json, then the global .sasjsrc. |
--force |
create |
Delete and re-create the folder when it already exists. |
Note
sasjs folder works on SAS Viya targets only - it manages SAS Drive folders, which SAS 9 does not have.
sasjs folder list¶
Used to list first level children folders of given folder.
Syntax¶
sasjs folder list <folderpath> -t target
Usage¶
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).
Syntax¶
sasjs folder create <folderpath> -t target -f
Usage¶
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.
Syntax¶
sasjs folder delete <folderpath> -t target
Usage¶
sasjs folder move¶
Moves an existing folder to a new location. It behaves similarly to the Unix mv command.
If targetpath is an existing folder, the folder will be moved underneath targetpath.
If targetpath does not exist, the folder is moved and renamed, inside the parent folder. See examples below.
Syntax¶
sasjs folder move <folderpath> <targetpath>
Usage¶
Moving folder to /Public
Moving folder to folder2 leaving it in same directory
Moving folder to /Public and renaming to folder2
Reason for rename - /Public/folder2 does not exist.