# 4. Mange Folder/File

### Overview

The Server File Browser is a powerful feature in ServerCompass that allows you to manage files and folders on your remote servers directly from your desktop. Navigate, upload, edit, and organize files with an intuitive interface similar to your local file explorer.

### Getting Started

The File Browser appears on your server's detail page. When you first open it, you'll see your home directory (`~`) with a list of files and folders.

#### Interface Layout

<figure><img src="/files/bKq7Wk5Wbm9YuSIP9IWQ" alt=""><figcaption></figcaption></figure>

The File Browser interface consists of:

* **Navigation Breadcrumbs**: Shows your current location in the filesystem
* **Toolbar**: Contains action buttons and view controls
* **File List**: Displays files and folders with details
* **Context Menu**: Right-click actions for individual files<br>

### Navigation

#### Browsing Folders

* **Click on any folder** to open it and view its contents
* **Use breadcrumbs** at the top to quickly jump to parent directories
* Click the **Home** button to return to your home directory (`~`)

#### Go to Specific Path

Need to jump to a specific directory?

1. Click the **Go to Path** button in the toolbar
2. Enter the full path (e.g., `/var/www/html` or `~/projects`)
3. Click **Go to Path** to navigate there

The system will verify the path exists before navigating.

### Viewing Files

#### List View vs Tree View

Toggle between two viewing modes:

* **List View** (default): Shows files in a detailed table with permissions, size, and modification date
* **Tree View**: Displays the directory structure as a hierarchical tree

**Note**: Tree view requires the `tree` command on your server. If not installed, ServerCompass will automatically install it for you.

#### Show/Hide Hidden Files

Toggle the **Show hidden files** checkbox to control visibility of files starting with a dot (`.`), such as `.bashrc` or `.ssh`.

#### Understanding File Information

Each file in List View shows:

* **Icon**: Visual indicator of file type (folder, code file, image, archive, etc.)
* **Name**: Filename (folders appear in bold blue text)
* **Size**: File size in human-readable format (folders show `—`)
* **Modified**: Last modification date and time
* **Permissions**: Unix permission string with helpful labels

#### File Permissions Explained

Hover over any permission to see what it means. Common permissions include:

* **Private file** (`-rw-------`): Only you can read/write
* **Public file** (`-rw-r--r--`): You can read/write, others can read
* **Private folder** (`drwx------`): Only you can access (like `.ssh`)
* **Standard folder** (`drwxr-xr-x`): Standard directory permissions
* **Executable file** (`-rwxr-xr-x`): Can be executed as a program

Click the **?** help icon next to "Permissions" in the header to learn more about the permission format.

### Uploading Files

#### Upload Individual Files

1. Click the **Upload Files** button
2. Select one or more files from your computer
3. Files will be uploaded to your current directory
4. Progress indicator shows upload status

#### Upload Entire Folders

1. Click the **Upload Folder** button
2. Select a folder from your computer
3. The entire folder structure will be recreated on the server
4. Progress shows current file and overall completion

**Note**: Large uploads may take time. The progress indicator displays:

* Current filename being uploaded
* Upload percentage
* File count (for folder uploads)

### Managing Files and Folders

#### Creating New Folders

1. Click the **New Folder** button
2. Enter a folder name
3. Press **Enter** or click **Create Folder**

The new folder appears in your current directory.

#### File Actions Menu

Click the **⋮** (three dots) next to any file to access actions:

**Rename**

1. Select **Rename** from the menu
2. Enter the new name
3. Press **Enter** or click **Rename**

**Move**

1. Select **Move** from the menu
2. Enter the destination path (e.g., `~/backup` or `/var/www`)
3. Click **Move**

**Tip**: You can include the new filename in the destination path to move and rename in one operation.

**Hide/Unhide**

Toggle file visibility by adding or removing a dot prefix:

* **Hide**: Renames `file.txt` to `.file.txt`
* **Unhide**: Renames `.file.txt` to `file.txt`

This follows Unix convention where files starting with `.` are hidden by default.

**Delete**

1. Select **Delete** from the menu
2. Confirm the deletion in the dialog
3. For folders: All contents will be permanently deleted

**Warning**: Deletion is permanent and cannot be undone. The system will show a warning for folder deletions.

### Editing Files

Click on any text file to open it in the built-in file editor. The editor supports:

* Syntax highlighting for common file types
* Real-time editing with save functionality
* View and modify file contents directly on the server

See the File Editor documentation for more details.

### Best Practices

#### Security

* Be careful when modifying system files (anything outside your home directory)
* Check permissions before deleting or moving critical files
* Private files (permissions `------`) in `.ssh` should remain private

#### Performance

* For large directory trees, use Tree View sparingly as it scans all subdirectories
* Upload multiple small files individually rather than zipping
* Use "Go to Path" for deep directory navigation instead of clicking through many levels

#### Organization

* Keep your home directory organized with clear folder names
* Use hidden files (starting with `.`) for configuration files
* Create dedicated folders for different projects or applications

### Troubleshooting

#### "Failed to fetch files"

* Check that your SSH connection is active
* Verify you have permission to access the directory
* Try navigating to your home directory with the Home button

#### "Tree command not found"

The app will automatically try to install `tree` using:

```bash
sudo apt install tree -y
```

If automatic installation fails, install it manually on your server.

#### Upload Failures

* Ensure you have write permissions in the current directory
* Check available disk space on the server
* Verify the SSH connection is stable

#### Permission Denied

Some operations require specific permissions:

* Creating folders: Write permission in the parent directory
* Deleting files: Write permission in the containing directory
* Accessing folders: Execute (`x`) permission

### Keyboard Shortcuts

* **Enter**: Submit any modal dialog (create folder, rename, move, etc.)
* **Escape**: Close modals (click outside or use the X button)

### Related Features

* **File Editor**: Edit text files directly on the server
* **Terminal**: Access command-line for advanced file operations
* **Server Settings**: Configure SSH connection details

### Technical Notes

#### Supported Operations

All file operations use standard Unix commands over SSH:

* Listing: `ls -lah` or `ls -lh`
* Navigation: `cd` commands
* Move/Rename: `mv` command
* Delete: `rm -f` (files) or `rm -rf` (folders)
* Create: `mkdir` command
* Upload: SFTP protocol via ssh2 library

#### File Path Formats

* Tilde (`~`) represents your home directory
* Absolute paths start with `/` (e.g., `/var/www`)
* Relative paths are relative to current directory

***

**Need Help?** The File Browser provides contextual help throughout:

* Hover over permissions for explanations
* Check error messages for specific issues
* Use the Permissions Help dialog for detailed information


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://server-compass.gitbook.io/server-compass-docs/basics-guide/4.-mange-folder-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
