Usage Examples
Real-world scenarios and workflows with FileFortress CLI

This page provides practical examples and common workflows to help you get the most out of FileFortress CLI. Each example includes step-by-step instructions and expected outcomes.

Before You Start

Make sure you have completed the Getting Started guide and have at least one cloud storage account connected.

Common Workflows

First-Time Setup
Complete setup from installation to first search
Advanced Search
Complex search queries and filtering techniques
Multi-Cloud Management
Managing files across multiple cloud providers
Maintenance Tasks
Regular maintenance and optimization tasks

First-Time Setup Workflow

Complete walkthrough from installation to your first successful file search.

Install & Verify
Initialize Device
Add Cloud Storage
Verify Setup
First Search
Step 1: Install and Verify

After installing FileFortress CLI, verify the installation:

filefortress --version

Expected output: Version number (e.g., "FileFortress CLI v1.2.3")

Step 2: Initialize Your Device

Choose your initialization method:

Option A: Interactive Mode (Recommended for Beginners)
filefortress init --interactive

Guided setup with step-by-step prompts. The system will ask you for:

  • Registration code from your dashboard
  • Device name (optional)
  • Device type (desktop, server, mobile)
  • Password setup (optional but recommended)
  • Key file creation (if you set a password)
Option B: Command Line Mode with Automatic Encryption
filefortress init --code YOUR_REGISTRATION_CODE

Uses machine-specific encryption - no password required for future commands.

Option C: Command Line Mode with Custom Password
filefortress --password mySecretPassword init --code YOUR_REGISTRATION_CODE --create-key-file

Creates a custom password and automatically generates a key file for convenience.

Which mode should I choose?
  • Interactive Mode: Best for first-time users, provides guidance
  • Automatic Encryption: Easier, tied to this machine only
  • Custom Password: More flexible, works across multiple devices

Expected output: "✓ Device successfully registered with ID: [device-id]"

If you used custom password mode, you'll also see key file creation confirmation.

Step 3: Add Your First Cloud Storage

Connect your Google Drive (or other cloud storage):

If you used automatic encryption mode:
filefortress remotes add gdrive
If you used custom password mode:
# Using password directly:
filefortress --password mySecretPassword remotes add gdrive

# Using key file (recommended):
filefortress --key-file filefortress.key remotes add gdrive

Follow the interactive prompts to authenticate with your cloud provider.

Expected outcome: Browser opens for authentication, then returns to CLI with success message.

Step 4: Verify Connection and Scan

Check that your remote is connected and perform initial scan:

Automatic encryption mode:
filefortress remotes list
filefortress remotes scan "My Google Drive"
Custom password mode (using key file):
filefortress --key-file filefortress.key remotes list
filefortress --key-file filefortress.key remotes scan "My Google Drive"

Expected output: List showing your connected remote, followed by scan progress.

Step 5: Verify Device Information

Check that your device is properly registered:

Automatic encryption mode:
filefortress device info
Custom password mode:
filefortress --key-file filefortress.key device info

Expected output: Device details, user information, and configuration status.

Step 6: Your First Search

Search for files to verify everything is working:

Automatic encryption mode:
filefortress find query --extensions pdf,docx --view summary
Custom password mode:
filefortress --key-file filefortress.key find query --extensions pdf,docx --view summary

Expected output: Summary of documents found across your connected storage.

🎉 Setup Complete!

You've successfully set up FileFortress and can now search across all your cloud storage accounts. Remember to keep your key file secure if you're using custom password mode.

Multi-Cloud Management Examples

Examples for managing files across multiple cloud storage providers.

Setting Up Multiple Cloud Accounts

Add multiple cloud storage providers:

# Add Google Drive
filefortress remotes add
# Follow prompts for Google Drive

# Add Dropbox
filefortress remotes add
# Follow prompts for Dropbox

# Add OneDrive
filefortress remotes add
# Follow prompts for OneDrive

# Verify all connections
filefortress remotes list --detailed
Cross-Cloud File Search

Search for the same file across all cloud providers:

filefortress find query --text "project proposal" --extension pdf

This will search across all connected cloud storage accounts and show which provider has the file.

Search specific providers only:

# Search only in Google Drive and Dropbox
filefortress find query --text "presentation" --remote "Google Drive"
filefortress find query --text "presentation" --remote "Dropbox"
Monitoring Cloud Storage Usage

Get comprehensive storage information for each provider:

# Get detailed storage information
filefortress remotes info "Google Drive" --refresh
filefortress remotes info "Dropbox" --refresh
filefortress remotes info "OneDrive" --refresh

Shows storage usage, account details, and sync statistics.

Synchronized Scanning

Scan all remotes to keep the index up-to-date:

# Scan all remotes
filefortress remotes scan --background

# Scan specific remote
filefortress remotes scan "Google Drive" --full

# Check scan status
filefortress remotes list

Regular Maintenance Tasks

Keep your FileFortress installation running smoothly with these maintenance routines.

Daily Maintenance (5 minutes)
# Check for CLI updates
filefortress update --check

# Quick scan of all remotes
filefortress remotes scan "My Google Drive"
filefortress remotes scan "My OneDrive"

# Check storage information
filefortress remotes info "My Google Drive"

Purpose: Ensure you have the latest features and your file index is current.

Weekly Maintenance (15 minutes)
# Full scan of all remotes
filefortress remotes scan --full

# Check for duplicate files
filefortress find duplicates --method hash --min-size 1MB

# Review large files
filefortress find query --size-min 50MB --format table

# Update CLI if needed
filefortress update

Purpose: Deep maintenance to identify duplicates and large files, ensure complete indexing.

Monthly Maintenance (30 minutes)
# Review and clean configuration
filefortress config list

# Check device information
filefortress device info

# Review old files (potential cleanup)
filefortress find query --modified-before $(date -d "1 year ago" +%Y-%m-%d) --size-min 10MB

# Enrich metadata for better search
filefortress remotes enrich

# Get comprehensive storage information
filefortress remotes info "My Google Drive" --refresh

Purpose: Comprehensive maintenance including metadata enrichment and configuration review.

Troubleshooting Common Issues

Search Returns No Results

Problem: Search commands return empty results even though files exist.

Solution:

# Check if remotes are connected
filefortress remotes list

# Perform full scan
filefortress remotes scan --full

# Try a broader search
filefortress find query --limit 10
Remote Connection Issues

Problem: Cloud storage connection fails or shows as disconnected.

Solution:

# Check remote status
filefortress remotes show "Remote Name"

# Remove and re-add the remote
filefortress remotes remove "Remote Name"
filefortress remotes add

# Check storage information
filefortress remotes info "Remote Name" --refresh
Device Not Registered

Problem: Commands fail with "device not registered" error.

Solution:

# Check device status
filefortress device info

# Re-initialize if needed
filefortress init --code YOUR_CODE --force
Password Required Error

Problem: Commands fail with "This database requires a password!" error.

Cause: You set up a custom password during initialization but didn't provide it.

Solution:

# Use your password directly
filefortress --password yourCustomPassword remotes list

# OR use your key file (if you created one)
filefortress --key-file path/to/your.key remotes list

# If you forgot your password, you'll need to reinitialize
filefortress --password newPassword init --code YOUR_CODE
Key File Not Working

Problem: "Failed to read password from key file" error.

Possible Causes: Missing files, wrong path, or file corruption.

Solution:

# Check if both .key and .store files exist
ls -la filefortress*.key filefortress*.store

# Try with absolute path
filefortress --key-file /full/path/to/your.key remotes list

# As fallback, use password directly
filefortress --password yourPassword remotes list

# Recreate key file if corrupted
filefortress --password yourPassword init --code YOUR_CODE --create-key-file
Cannot Use Both Password and Key File

Problem: "Cannot specify both --password and --key-file options!" error.

Solution: Choose only one authentication method per command.

# Wrong - using both
filefortress --password myPass --key-file my.key remotes list

# Correct - use either password OR key file
filefortress --password myPass remotes list
# OR
filefortress --key-file my.key remotes list

Automation Examples

Automate common tasks with scripts and scheduled commands.

Bash Scripts (Linux/macOS)

Daily Backup Check Script
#!/bin/bash
# daily-check.sh

echo "=== FileFortress Daily Check ==="
echo "Date: $(date)"

# Check for updates
echo "Checking for updates..."
filefortress update --check

# Scan remotes
echo "Scanning remotes..."
filefortress remotes scan

# Check storage information
echo "Checking storage information..."
filefortress remotes info "My Google Drive"

echo "Daily check complete!"
Find Large Files Script
#!/bin/bash
# find-large-files.sh

SIZE_THRESHOLD=${1:-100MB}
OUTPUT_FILE="large-files-$(date +%Y%m%d).csv"

echo "Finding files larger than $SIZE_THRESHOLD..."
filefortress find query --size-min "$SIZE_THRESHOLD" --format csv > "$OUTPUT_FILE"

echo "Results saved to $OUTPUT_FILE"
echo "Total large files found: $(wc -l < "$OUTPUT_FILE")"
Add Amazon S3 interactively:
filefortress remotes add s3 --interactive
Starts an interactive session to add an S3 remote. It will prompt for your Access Key and Secret Key, then discover your S3 buckets and allow you to select which ones to include.

PowerShell Scripts (Windows)

Weekly Maintenance Script
# weekly-maintenance.ps1

Write-Host "=== FileFortress Weekly Maintenance ===" -ForegroundColor Green
Write-Host "Date: $(Get-Date)" -ForegroundColor Yellow

# Update CLI
Write-Host "Updating CLI..." -ForegroundColor Cyan
& filefortress update

# Full scan
Write-Host "Performing full scan..." -ForegroundColor Cyan
& filefortress remotes scan --full

# Find duplicates
Write-Host "Finding duplicate files..." -ForegroundColor Cyan
& filefortress find duplicates --method hash --min-size 1MB

Write-Host "Weekly maintenance complete!" -ForegroundColor Green

Scheduled Tasks

Linux/macOS Cron Jobs
# Edit crontab: crontab -e

# Daily scan at 9 AM
0 9 * * * /usr/local/bin/filefortress remotes scan

# Weekly full scan on Sundays at 2 AM
0 2 * * 0 /usr/local/bin/filefortress remotes scan --full

# Monthly storage info check on 1st of month at 8 AM
0 8 1 * * /usr/local/bin/filefortress remotes info "My Google Drive" --refresh
Windows Task Scheduler

Create scheduled tasks using Windows Task Scheduler:

  1. Open Task Scheduler
  2. Create Basic Task
  3. Set trigger (daily, weekly, etc.)
  4. Action: Start a program
  5. Program: filefortress.exe
  6. Arguments: remotes scan