# Command-line Interface (CLI)

### What is a CLI?

* FSV CLI is a command-line tool that offers the most features from UI for scanning folders, creating reports, and exporting them with simple commands.
* It primarily consists of these commands:
  * `pr [args]` for Permissions Reports
  * `fr [args]` for Forder Reports
  * `or [args]` for Owner Reports
* FSV CLI can export the reports to Excel, HTML, or CSV files.
* FSV CLI can save the reports to your configured database.

### How To Use the CLI?

* Open a `Windows Command Prompt` in `C:\Program Files\FolderSecurityViewer`.
* Type in `fsv` to get the help screen.

#### Examples:

<figure><img src="https://1703393555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKfeAk5N9nO8pPilv5bqH%2Fuploads%2FgyoFSNJewL1gmrwwrjRE%2Fcli-large.png?alt=media&#x26;token=4368d73f-9ac4-408e-8da7-84fc4afadd21" alt=""><figcaption></figcaption></figure>

### How To Generate a Permissions Report

* Use `fsv pr [path]` to generate a Permissions Report on given folder, and export the results in specified file format.
* Arguments:
  * `[path]`
    * A path (local or UNC) of a folder to scan. Use quotes if the path has whitespace in it.
    * Required
* Options:
  * `-h|-?|--help`
    * Show help information
  * `-e|--export`
    * Export to file: `excel`, `csv`, or `html`
    * Optional. If this option is omitted, HTML is used.
  * `-p|--path 'path\file'`
    * The path and file name where the exported report is saved.
    * File name is optional. If omitted, the file is named of current date.
    * Optional. If this option is omitted, the file is created in `FolderSecurityViewer\Export` in your `Documents` folder.
  * `-d|--db`
    * Saves report to configured database.
    * Optional.
    * Caution: If this option is used in combination with `--export` no file is created. Don’t mix these options!

#### Examples:

<figure><img src="https://1703393555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKfeAk5N9nO8pPilv5bqH%2Fuploads%2FDDPOpO9wngl04AuCeLaz%2Fcli-pr-large.png?alt=media&#x26;token=c32e9016-ae6c-46a9-a5d1-66f356bb745a" alt=""><figcaption></figcaption></figure>

### How To Generate a Folder Report

* Use `fsv fr [path]` to generate a Folder Report on given folder to flatten specific folder, and its subfolders into a single list with details like owner, size of folder, and number of files in it.
* Arguments:
  * `[path]`
    * A path of a folder to scan. Use quotes if the path has whitespace in it.
    * Required
* Options:
  * `-h|-?|--help`
    * Show help information
  * `-e|--export`
    * Export to file: MS Excel, csv, or Html
    * Optional. If this option is omitted, HTML is used.
  * `-p|--path 'path\file'`
    * The path and file name where the exported report is saved.
    * File name is optional. If omitted, the file is named of current date.
    * Optional. If this option is omitted, the file is created in `FolderSecurityViewer\Export` in your `Documents` folder.

#### Examples:

<figure><img src="https://1703393555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKfeAk5N9nO8pPilv5bqH%2Fuploads%2FiMlY2wfh9nqsrEzYnkYO%2Fcli-fr-large.png?alt=media&#x26;token=bcf12b0c-6e71-4648-8955-4dbda7fd8dab" alt=""><figcaption></figcaption></figure>

### How To Generate a Owner Report

* Use `fsv or [path]` to generate a Owner Report on given folder and its subfolders to find out the folders in which specified user is set as an owner.
* Arguments:
  * `[path]`
    * A path of a folder to scan. Use quotes if the path has whitespace in it.
    * Required
  * `[owner]`
    * Name of a user to scan the folder for its ownership.
    * Required, but if this argument is not provided, the export file lists all folders with name of their owners.
* Options:
  * `-h|-?|--help`
    * Show help information
  * `-e|--export`
    * Export to file: MS Excel, csv, or Html
    * Optional. If this option is omitted, HTML is used.
  * `-p|--path 'path\file'`
    * The path and file name where the exported report is saved.
    * File name is optional. If omitted, the file is named of current date.
    * Optional. If this option is omitted, the file is created in `FolderSecurityViewer\Export` in your `Documents` folder.

#### Examples:

<figure><img src="https://1703393555-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKfeAk5N9nO8pPilv5bqH%2Fuploads%2Fj5nICRszNHhllpefVslK%2Fcli-or-large.png?alt=media&#x26;token=ac7171d9-efdf-488e-b025-ff51ed1dcf1f" alt=""><figcaption></figcaption></figure>
