# Folder Commands

### Overview

The page shows folder commands. the currently supported commands are

1. [List Folders command](#list-folder-command)
2. [Move Folder Command](#move-folder-command)
3. [Remove Folder Command](#remove-folder-command)
4. [Create Directory Command](#make-directory-command)
5. [Edit Directory Command](#update-folder-command)
6. [Change Directory Command](#change-directory-command)
7. [Get Keeper Folder Command (PowerShell only)](#get-keeper-folder-command)

### List Folder Command

This command return information for a given UID. The UID can be for a record, folder, shared folder or a team. The information can be printed as a json or as a list of details

<details>

<summary>DotNet CLI</summary>

**Command**: `ls`&#x20;

**Flags:**&#x20;

* `l` : details

**Example:**

```bash
My Vault> ls -l
  #  Folder UID              Name                           
---  ----------------------  -------------------------------
  1  folder_uid              Actest/                        
  2  folder_uid              ChecKRustWindows               
  3  folder_uid              Example-shared-folder          
  4  folder_uid              main_credentials_shared_folder 
  5  folder_uid              main_folder_for_init_test      
                      
```

</details>

<details>

<summary>DotNet SDK</summary>

The current implementation of the command in DotNet SDK follows searching of the given UID among different categories

```csharp
public bool TryGetFolder(string folderUid, out FolderNode node)
```

then use the node to get subfolders and all their data using&#x20;

```csharp
var subFolders = node.Subfolders;
```

Now the data of these subfolders can be accessed

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Get-KeeperFolders`

**Aliases:** `kfolders`&#x20;

**Parameters:**

* **`-Filter`** (string, optional) - Filter folders by name. Supports wildcards (\* and ?). Example: `"Engineering*"`
* **`-Type`** (string, optional) - Filter by folder type: `'All'` (default), `'User'`, or `'Shared'`
* **`-IncludeRoot`** (switch, optional) - Include the root folder in results
* **`-AsObject`** (switch, optional) - Return folder objects for pipeline use instead of formatted display
* **`-Verbose`** (switch, optional) - Show detailed information including full folder paths

**Example:**

```powershell
PS> Get-KeeperFolders -Type Shared -IncludeRoot -Verbose          

Found 9 folder(s)

UID                    Name                           Type               Subfolders Records Path
---                    ----                           ----               ---------- ------- ----
Yi_OxwTV2tdBWi-_Aegs_w Demo Folder                    SharedFolder                1       4 /Demo Folder/
IjMo9BzlhPmZnGRQI8feYg My folder                      SharedFolderFolder          1       0 /Demo Folder/My folder/
FsCYGSOz71gkbcg7okedmQ My subfolder                   SharedFolderFolder          0       0 /My subfolder/
8N6xqMChTWAL-r_wIdzV8A my_share                       SharedFolder                1       2 /my_share/
jB6_X9sDvc2ZQy4rZtSt3A New Sub-Folder                 SharedFolderFolder          1       0 /New Sub-Folder/
Lp0G8YP3aDEj627K_I2_BA New Sub-Folder                 SharedFolderFolder          0       0 /Demo Folder/My folder/New Sub-Folder/
h0dtYN_8hpUWyeGHRj5jRA PowerCommanderCreatedFolder    SharedFolderFolder          0       0 /New Sub-Folder/PowerCommanderCreatedFolder/
kxR69Qfymrrx7SKtzpwFlg test_share_folder_folder       SharedFolderFolder          1       1 /my_share/test_share_folder_folder/
KjcKBnhzkVrgBVH6ujTlqA testrtg                        SharedFolderFolder          0       1 /my_share/test_share_folder_folder/testrtg/

```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `ls`&#x20;

**Options:**

* `-l`        `--list`                       Display output in list format
* `-f`        `--folders`                 Display folder names only in output
* `-r`        `--records`                 Display records in output
* `-v`       `--verbose`                  Show verbose output

**Example:**

```sh
My Vault> ls -l
  #  Flags    UID                     Name                                                      Type
---  -------  ----------------------  --------------------------------------------------------  -----------------
  1  f---     folder_uid              User-ks
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `get_folder`

```python
get_folder(self, folder_uid: str) -> Optional[vault_types.Folder]
```

**Example:**

```python
 folder = vault.vault_data.get_folder(folder_uid)
```

</details>

### Move Folder Command

Moves records or folders from one location to another within the vault.

<details>

<summary>DotNet CLI</summary>

**Command:** `mv`&#x20;

**Flag:**&#x20;

* `--link` : do not delete source
* `source record or folder (pos. 0)`  : Required. source record or folder
* `destination folder (pos. 1)` : Required. destination folder

**Example:**

```bash
My Vault > mv <source_record/source_folder> <destination_folder>
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

```csharp
public async Task MoveFolder(string srcFolderUid, string dstFolderUid, bool link = false)
```

**Arguments** :&#x20;

`srcFolderUid`  -  UID of the source folder. this is the folder which will be moved to a different place

`dstFolderuid`  -  UID of the folder to whose location the earlier folder will be moved to.&#x20;

`link`  - this flag when sets to `true` will not remove the source folder from source and link the new folder at destination to source folder. When this is set to `false` , the source folder will be moved from source to dest.

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Move-RecordToFolder` &#x20;

**Aliases:** `kmv`

**Flag** :&#x20;

* `-Records` : Uid of records
* `-Folder` : Folder Uid&#x20;
* `-Link`&#x20;

**Example:**

```powershell
PS > Move-RecordToFolder -Records record_uid -Folder folder_uid
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `mv`

**Parameter:**  required

* `Source pos 0`                       Required - source folder or record UID or path&#x20;
* `Destination pos 1`            Required - destination folder UID or path

**Options**:

* `-l`, `--link`                             Do not delete source
* `-f`, `--force`                           Do not prompt
* -R, --recursive                        Apply search pattern to folders as well
* -s, --can-reshare                   {on, off}  apply "Can Share" record permission
* -e, --can-edit                         {on, off} apply "Can Edit" record permission

**Example:**

```bash
My Vault> mv <source_record/source_folder> <destination_folder>
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `move_vault_objects`

**Example:**&#x20;

```python
# here source uids are folder uids 
# paths to the records inside is record_paths
record_management.move_vault_objects(
     context.vault,
     src_objects=itertools.chain(source_uids, record_paths),
     dst_folder_uid=dst_folder.folder_uid,
     is_link=kwargs.get('link') is True,
     can_edit=can_edit, 
     can_share=can_share,
     on_warning=on_warning)
```

</details>

### Remove Folder Command

Moves records or folders from one location to another or renames them within the vault.

<details>

<summary>DotNet CLI</summary>

**Command:** `rmdir`&#x20;

**Flag:**&#x20;

* `(pos. 0)` : folder name or UID. this will be useful for removing folders.

**Example:**

```bash
My Vault> rmdir some_new_folder/
1 Shared Folder(s) will be deleted.
Note: If the last reference to a record is removed, the record can be found in the owner's trash can. If the trash can is then emptied, the record is no longer recoverable.
Type "yes" to confirm, <Enter> to cancel
> yes

```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**&#x20;

```csharp
public Task DeleteFolder(string folderUid)
```

**Arguments** :&#x20;

`folderUid`  -  folder to remove

</details>

<details>

<summary>Power Commander</summary>

**Command:**

```powershell
PS> Remove-KeeperFolder test_folder_for_delete 
```

**Flags:**

`Name`  - Name or UID of folder to delete

</details>

<details>

<summary>Python CLI</summary>

**Command:** `rmdir`

**Parameter:**&#x20;

* `folder`             Folder path or uid to be deleted (required)

**Options**:

* `-f`       `--force`         Skip confirmation prompts
* `-q`      `--quiet`         Don't display folder info while removing

**Example:**

```bash
My Vault> rmdir deleted_folder

The following folder(s) will be removed:
deleted_folder

1 Personal Folder(s) will be deleted.
Note: If the last reference to a record is removed, the record can be found in the owner's trash can. If the trash can is then emptied, the record is no longer recoverable.
 
Do you want to proceed with the folder deletion? [y/n]: y
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `delete_vault_objects`&#x20;

```python
 delete_vault_objects(vault: vault_online.VaultOnline,
                         vault_objects: Iterable[Union[str, vault_types.RecordPath]],
                         confirm: Optional[Callable[[str], bool]]=None) -> None:
```

**Example:**&#x20;

```python
 record_management.delete_vault_objects(context.vault, list(folder_uids), delete_confirmation)
```

</details>

### Tree Command

Shows a hierarchical tree view of folders and records in the vault, similar to the Unix `tree` command. Shows the directory structure.

<details>

<summary>DotNet CLI</summary>

**Command** : `tree`

**Flag** :&#x20;

* `folder (pos. 0)` : folder path or UID

**Example:**

```bash
My Vault > tree

My Vault
 +-- New Test Folder
 |   +-- example-normal-folder
 |       +-- test-example-subfolder
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Not Supported

</details>

<details>

<summary>Power Commander</summary>

**Command** :  Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command** : `tree`

**Options**:

* **`-v, --verbose`**  - Prints internal IDs (e.g., folder UIDs) in addition to names.
* **`-r, --records`**  - Displays the records contained within each folder.
* **`-s, --shares`**  - Shows share permission details for each shared folder.
* **`-hk, --hide-shares-key`**  - Hides the share permissions key legend. Valid only when used together with `--shares`. By default, the key is displayed whenever `--shares` is enabled.
* **`-t, --title`** - Prints an optional title above the folder structure output.
* **`folder`**  - Folder path or UID to display. If omitted, shows the root folder.

**Example:**

```bash
My Vault> tree "Test-normal-folder"
Test-normal-folder
 +-- example-folder
 +-- Shared-Folder-Example [Shared]
 +-- Test PowerCommander Folder [Shared]
```

</details>

<details>

<summary>Python SDK</summary>

Not Supported

</details>

### Create Directory Command

Creates a new folder within your Keeper vault to help organize records and other folders.

<details>

<summary>DotNet CLI</summary>

**Command** : `mkdir`

**Flags** :&#x20;

* `folder name` : Required. folder name
* `-s, --shared (Default: false)` : shared folder
* `--manage-users` : default manage users. `true` or `false`. By default this is `false` .
* `--manage-records` : default manage records. `true` or `false`. By default this is `false` .
* `--can-share` : default can share. `true` or `false`. By default this is `false` .
* `--can-edit` : default can edit. `true` or `false`. By default this is `false` .

**Example:**

```bash
My Vault>  mkdir -s "Test-Dotnet-Cli-Folder" --manage-users true  --manage-records true --can-share true  --can-edit true
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** &#x20;

```csharp
Task<FolderNode> CreateFolder(string name, string parentFolderUid = null,
            SharedFolderOptions sharedFolderOptions = null);
```

**Flag** :&#x20;

`name`  -  Name of the folder which has to be created. This will be title of folder record which is created.

`parentFolderUid`  - UID of parent folder.

**SharedFolderOptions:**

`ManageUsers` : default manage users. `true` or `false`. By default this is `false` .

`ManageRecords` : default manage records. `true` or `false`. By default this is `false` .

`CanShare`   :  default can share. `true` or `false`. By default this is `false` .

`CanEdit`     : default can edit. `true` or `false`. By default this is `false` .

</details>

<details>

<summary>Power Commander</summary>

**Command** : `Add-KeeperFolder` or `kmkdir`

**Flag** :&#x20;

* `-Name` : Name of the folder which is to be created
* `-ParentFolderUid` : Parent Folder Uid under which current folder is to be created
* `-Shared` : whether this will be shared folder or normal folder. this can be set to `true` if we want shared folder to be created, else we can set it to `false`.&#x20;
* `-CanEdit` : default can edit. `true` or `false`. By default this is `false` .
* `-CanShare` : default can share. `true` or `false`. By default this is `false` .
* `-ManageUsers` : default manage users. `true` or `false`. By default this is `false` .
* `-ManageRecords` : default manage records. `true` or `false`. By default this is `false` .

**Example:**

```powershell
PS > Add-KeeperFolder -Name "Test PowerCommander Folder" -ParentFolderUid folder_uid -Shared -CanEdit -CanShare 

FolderUid     Name            FolderType     ParentUid           SubfolderCount   RecordCount
                                                                                                     t
---------     ----            ----------     ---------           --------------   ----------
Folder UID    Test Folder     SharedFolder   Parent_folder_uid    0               0
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** : `mkdir`

**Parameters:**

* `folder` : Name of folder (required)

**Options:**&#x20;

* `-sf, --shared-folder` : create shared folder
* `-uf, --user-folder` : create user folder
* `-a, --all` : anyone has all permissions by default
* `-u, --manage-users` : anyone can manage users by default
* `-r, --manage-records` : anyone can manage records by default
* `-s, --can-share` : anyone can share records by default
* `-e, --can-edit` : anyone can edit records by default

**Example:**

```bash
My Vault> mkdir -sf "Test-Python-Cli-Folder" -s -e
folder_uid ##Outputs created folder uid
```

</details>

<details>

<summary>Python SDK</summary>

**Function**: `add_folder`

```python
add_folder(vault: vault_online.VaultOnline, folder_name: str, is_shared_folder: bool=False,
               parent_uid: Optional[str]=None, manage_records: Optional[bool]=None, manage_users: Optional[bool]=None,
               can_share: Optional[bool]=None, can_edit: Optional[bool]=None)
```

**Example**:&#x20;

```python
folder_uid = folder_management.add_folder(
                context.vault, folder_name, is_shared_folder, base_folder.folder_uid, manage_users, manage_records, can_edit, can_share)
```

</details>

### Update Folder Command

This command used to edit an existing Keeper folder in the vault. It resolves the folder by UID or name, optionally configures shared folder permissions.

<details>

<summary>DotNet CLI</summary>

**Command** : `update-dir`

**Flags** :&#x20;

* `--name` : A new name for the folder (rename).
* `--manage-users` : default manage users. `true` or `false`. By default this is `false` .
* `--manage-records` : default manage records. `true` or `false`. By default this is `false` .
* `--can-share` : default can share. `true` or `false`. By default this is `false` .
* `--can-edit` : default can edit. `true` or `false`. By default this is `false` .

**Example:**

```bash
My Vault>  update-dir "Old Folder Name" --name "New Project Folder" --can-edit true --can-share true --manage-users true --manage-records true
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** &#x20;

```csharp
Task<FolderNode> UpdateFolder(string folderUid, string newName, SharedFolderOptions sharedFolderOptions = null);
```

**Flag** :&#x20;

`folderUid`  - UID of folder.

`newName`  -  A new name for the folder (rename).

**SharedFolderOptions :**

`ManageUsers` : default manage users. `true` or `false`. By default this is `false` .

`ManageRecords` : default manage records. `true` or `false`. By default this is `false` .

`CanShare`   :  default can share. `true` or `false`. By default this is `false` .

`CanEdit`     : default can edit. `true` or `false`. By default this is `false` \`.

</details>

<details>

<summary>Power Commander</summary>

**Command** : `Edit-KeeperFolder`

**Flag** :&#x20;

* `-Uid` : The Folder UID or Name to identify which folder to edit.
* `-Name` : A new name for the folder (rename).
* `-Shared` : whether this will be shared folder or normal folder. this can be set to `true` if we want shared folder to be created, else we can set it to `false`.&#x20;
* `-CanEdit` : default can edit. `true` or `false`. By default this is `false` .
* `-CanShare` : default can share. `true` or `false`. By default this is `false` .
* `-ManageUsers` : default manage users. `true` or `false`. By default this is `false` .
* `-ManageRecords` : default manage records. `true` or `false`. By default this is `false` .

**Example:**

```powershell
PS > Edit-KeeperFolder -Uid QpR86NvOnfvGYf_urfltFw  -Name A122

FolderUid              Name FolderType ParentUid SubfolderCount RecordCount
---------              ---- ---------- --------- -------------- -----------
QpR86NvOnfvGYf_urfltFw A122 UserFolder           0              0
```

</details>

<details>

<summary>Python CLI</summary>

Not Implemented

</details>

<details>

<summary>Python SDK</summary>

Not Implemented

</details>

### Change Directory Command

Keeper uses directory structure to organize records as records and folders. This command helps navigate keeper folders.

<details>

<summary>DotNet CLI</summary>

**Command** : `cd`

**Flag** :&#x20;

* `folder destination or Uid`&#x20;

**Example:**         &#x20;

```bash
My Vault> cd Test-Dotnet-Cli-Folder

My Vault/Test-Dotnet-Cli-Folder> 
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function :** Not Applicable

**Example:**

1. Get the folder uid or name from the user.
2. resolve the path using `TryResolvePath`  function and get the outputted folder if it exists into node variable.
3. if node variable is not null, then `FolderUid` of the given node will be your current vault folder&#x20;

<pre class="language-csharp"><code class="lang-csharp">vault.TryResolvePath(name, out var node)
<strong>vault.CurrentFolder = node.FolderUid;
</strong></code></pre>

</details>

<details>

<summary>Power Commander</summary>

**Command** : `Set-KeeperLocation`  or `kcd`

**Flag** :&#x20;

* `-Path`  - path to navigate to folder needed. This can be just name.

**Example:**

```powershell
PS > Set-KeeperLocation /Test-normal-folder
```

**Command** : `Get-KeeperLocation`&#x20;

**Example:**

```powershell
	Get current Keeper folder path
PS >  Get-KeeperLocation

Path
----
\
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `cd`

**Parameter:**&#x20;

* `FOLDER`        Folder path or UID (required)

**Example:**

```bash
My Vault> cd folder_uid
My Vault/Test-Python-Cli-Folder>
```

</details>

<details>

<summary>Python SDK</summary>

Not Supported

</details>

### Get Keeper Folder Command

<details>

<summary>Power Commander</summary>

**Command:** `Get-KeeperFolder`

Get detailed information about a Keeper folder.

**Flags:**

`Uid` - Uid of the folder to show details for.

**Usage:**

```
PS> Get-KeeperFolder abcdefg(uid)
PS> Get-KeeperFolder abcdefg(uid) -AsObject
```

**Example:**

```
PS> Get-KeeperFolder _56dJ6GUKYDSp4NfRomIaa

    Folder UID          : _56dJ6GUKYDSp4NfRomIaa
    Folder Type         : SharedFolder
    Name                : ChecK123455
    Shared Folder UID   : _56dJ6GUKYDSp4NfRomIaa
    Full Path           : /ChecK123455/
    Subfolders          : 2
    Records             : 10
```

</details>
