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.
Common Workflows
First-Time Setup Workflow
Complete walkthrough from installation to your first successful file search.
After installing FileFortress CLI, verify the installation:
filefortress --version
Expected output: Version number (e.g., "FileFortress CLI v1.2.3")
🚀 New users should use this approach! The setup command does everything in one go:
Complete Setup (Recommended)
filefortress setup
This single command will:
- Initialize your device (prompts for registration code)
- Ask if you want to set up a custom password (recommended for security)
- Optionally create a key file so you don't have to type the password each time
- Guide you through connecting cloud storage (S3, Google Drive, or OneDrive)
- Automatically scan your files to build the search index
- Verify everything is working
Expected outcome: Complete FileFortress setup ready for searching files.
Note: Most users should use the setup
command above. This section is for users who prefer manual control.
Manual Device Initialization
filefortress init
Or with specific parameters:
filefortress init --code YOUR_REGISTRATION_CODE
Manual Cloud Storage Connection
# Interactive mode (recommended)
filefortress remotes add gdrive
filefortress remotes add onedrive
filefortress remotes add s3
All remote add commands run in interactive mode by default for wizard-style prompts that guide you through the setup process.
Manual File Scanning
filefortress remotes scan "Remote Name"
You can also use the remote ID (number) instead of the name.
Expected output: Same as setup command, but requires multiple steps.
Search for files to verify everything is working:
filefortress find query --extensions pdf,docx --view summary
Or if you used a custom password:
filefortress --key-file filefortress.key find query --extensions pdf,docx --view summary
Expected output: Summary of documents found across your connected storage.
Advanced Search Examples
Master the search functionality with these advanced examples.
Identify files larger than 50MB to free up storage space:
filefortress find query --size-min 50MB --format table
Use case: Storage cleanup and identifying large files across all your cloud accounts.
For even more detailed analysis, sort by size:
filefortress find query --size-min 10MB --format json | jq 'sort_by(.size) | reverse'
Find documents modified in the last 30 days:
filefortress find query --modified-after $(date -d "30 days ago" +%Y-%m-%d) --extension docx,pdf,pptx
Use case: Quickly locate recent work files for project reviews or backups.
Find files modified today:
filefortress find query --modified-after $(date +%Y-%m-%d)
Find all images across your cloud storage:
filefortress find query --extension jpg,jpeg,png,gif,bmp,tiff --limit 50
Find all spreadsheets containing "budget":
filefortress find query --text "budget" --extension xlsx,xls,csv
Find all code files:
filefortress find query --extension js,ts,py,java,cs,cpp,h --limit 100
Find large PDF reports from this year:
filefortress find query --text "report" --extension pdf --size-min 1MB --modified-after 2024-01-01
Find old large files (potential cleanup candidates):
filefortress find query --size-min 100MB --modified-before 2023-01-01
Find presentation files in specific cloud storage:
filefortress find query --extension pptx,ppt --remote "Google Drive" --text "meeting"
Find duplicate files using hash comparison (most accurate):
filefortress find duplicates --method hash --min-size 1MB
Find duplicate images:
filefortress find duplicates --method hash --extensions jpg,png,gif --group-by size
Find files with similar names (potential duplicates):
filefortress find duplicates --method name --min-size 100KB
Find Canon photos taken after 2020 with high resolution:
filefortress search "IMG" --media-type image --meta "exif.cameraMake=Canon" --meta "exif.takenAt>=2020-01-01" --meta "image.width>=4000"
Search files by hash prefix across all providers:
filefortress find query --meta "hash.md5^=d128a6ef"
Find unshared files owned by company emails:
filefortress find query --meta "owner.email~=company.com" --meta "sharing.shared=false"
Search specific camera models with portrait orientation:
filefortress search "" --meta "exif.cameraModel in Canon PowerShot|Nikon D850" --meta "image.height>image.width"
Find photos with specific ISO and aperture settings:
filefortress find query --media-type image --meta "exif.iso>=800" --meta "exif.fNumber<=2.8"
Metadata Search Examples
FileFortress supports powerful metadata filtering using the --meta
option across all major commands (search, find query, ls). This allows you to search by EXIF data, file properties, ownership, and provider-specific metadata.
Find all Canon photos taken in 2023:
filefortress search "" --media-type image --meta "exif.cameraMake=Canon" --meta "exif.takenAt>=2023-01-01" --meta "exif.takenAt<2024-01-01"
Search for high-quality portrait photos:
filefortress find query --media-type image --meta "image.height>image.width" --meta "image.width>=3000" --meta "exif.fNumber<=2.8"
Find landscape photos with wide aperture:
filefortress search "landscape" --meta "image.width>image.height" --meta "exif.fNumber>=8.0" --save-query "landscape-photos"
List recent photos by specific camera model:
filefortress ls --media-type image --meta "exif.cameraModel~=D850" --meta "exif.takenAt>=2024-01-01" --long --sort time
Find files by hash for deduplication:
filefortress search "" --meta "hash.md5^=d128a6ef" --view list
Search by file ownership across providers:
filefortress find query --meta "owner.email~=gmail.com" --remote-type gdrive
Find shared files for privacy review:
filefortress search "" --meta "sharing.shared=true" --save-to-file shared-files-report.txt
List files by MIME type:
filefortress ls --meta "mime.type^=application/" --files-only --sort size --reverse
Search only Google Drive with specific criteria:
filefortress search "project" --remote-type gdrive --meta "owner.displayName~=John"
Find OneDrive files with specific hash types:
filefortress find query --remote-type onedrive --meta "hash.sha1 exists"
Search S3 files by storage class:
filefortress search "backup" --remote-type s3 --meta "provider.storageClass in GLACIER|DEEP_ARCHIVE"
Find large, unshared images from specific camera:
filefortress find query --media-type image --size-min 10MB --meta "exif.cameraMake=Canon" --meta "sharing.shared=false" --meta "image.width>=4000"
Search for documents created by company users:
filefortress search "report" --extensions pdf,docx --meta "owner.email$=company.com" --modified-after "30 days"
Find photos taken with manual camera settings:
filefortress find query --media-type image --meta "exif.exposureTime<=0.01" --meta "exif.iso>=800" --meta "exif.fNumber<=2.8" --save-query "manual-night-photos"
Browsing and Listing Files
Use the ls
command to explore your files and folders directly from the command line, including a powerful interactive mode.
For an interactive, user-friendly way to browse your files, use the default interactive mode. This launches a terminal-based UI where you can navigate folders, view file details, and change display options on the fly.
filefortress ls
Use case: Ideal for exploring your storage without having to remember complex commands. You can easily navigate through your remote directories, sort files, and toggle display formats.
Get a simple list of files and folders in a specific path:
filefortress ls "My GDrive:/Backups/Photos"
For more details, use the --long
format:
filefortress ls "My GDrive:/Backups/Photos" --long
Use case: Quickly check the contents of a directory or get detailed information like file size and modification date.
List all PNG files recursively within a directory:
filefortress ls --recursive --extensions png --files-only
Find all folders inside a specific remote, sorted by name:
filefortress ls --folders-only --sort name --remote-name "My GDrive"
Use case: Great for quickly finding specific types of files or organizing your directory structure by listing only folders.
Multi-Cloud Management Examples
Examples for managing files across multiple cloud storage providers.
Add multiple cloud storage providers:
# Add Google Drive (interactive - recommended)
filefortress remotes add gdrive
# Follow the wizard-style prompts for Google Drive
# Add OneDrive (interactive - recommended)
filefortress remotes add onedrive
# Follow the wizard-style prompts for OneDrive
# Add Amazon S3 (interactive - recommended)
filefortress remotes add s3
# Follow the wizard-style prompts for S3 (Access Key, Secret Key, bucket selection)
# Verify all connections
filefortress remotes list --detailed
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"
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.
Scan all remotes to keep the index up-to-date:
# Scan all remotes
filefortress remotes scan --background
# Scan specific remote (by name or ID)
filefortress remotes scan "Google Drive"
filefortress remotes scan 1 # Using remote ID
# Check scan status
filefortress remotes list
Regular Maintenance Tasks
Keep your FileFortress installation running smoothly with these maintenance routines.
# Check for CLI updates
filefortress update --check
# Quick scan of all remotes (by name or ID)
filefortress remotes scan "My Google Drive"
filefortress remotes scan 1 # Using remote ID
# Check storage information
filefortress remotes info "My Google Drive"
Purpose: Ensure you have the latest features and your file index is current.
# Scan all remotes
filefortress remotes scan
# 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.
# 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
Problem: Search commands return empty results even though files exist.
Solution:
# Check if remotes are connected
filefortress remotes list
# Perform scan
filefortress remotes scan
# Try a broader search
filefortress find query --limit 10
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
Problem: Commands fail with "device not registered" error.
Solution:
# Check device status
filefortress device info
# Re-initialize if needed
filefortress init --code YOUR_CODE
Problem: Your device was working, but you accidentally removed it from the FileFortress web portal and now it cannot sync.
Solution: Use the reinit
command with a new registration code from the portal.
# Get a new registration code from the web portal
# Run the reinit command with the new code
filefortress reinit --code <your-new-registration-code>
# If you use a custom password, provide it as well
filefortress --password yourSecretPassword reinit --code <your-new-registration-code>
This will re-link your device to your account without affecting your local data or password settings.
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
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
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)
#!/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!"
#!/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 any supported cloud storage with wizard-style prompts
filefortress remotes add gdrive
filefortress remotes add onedrive
filefortress remotes add s3
#!/bin/bash
# metadata-photo-search.sh
COUNT_THRESHOLD=${1:-100}
echo "Finding Canon photos taken after 2020..."
filefortress search "" --media-type image \
--meta "exif.cameraMake=Canon" \
--meta "exif.takenAt>=2020-01-01" \
--meta "image.width>=4000" \
--view summary
echo "Finding unshared company files..."
filefortress find query \
--meta "owner.email~=company.com" \
--meta "sharing.shared=false" \
--save-query "company-private-files"
PowerShell Scripts (Windows)
# 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
# Scan all remotes
Write-Host "Scanning all remotes..." -ForegroundColor Cyan
& filefortress remotes scan
# 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
# Edit crontab: crontab -e
# Daily scan at 9 AM
0 9 * * * /usr/local/bin/filefortress remotes scan
# Weekly scan on Sundays at 2 AM
0 2 * * 0 /usr/local/bin/filefortress remotes scan
# Monthly storage info check on 1st of month at 8 AM
0 8 1 * * /usr/local/bin/filefortress remotes info "My Google Drive" --refresh
Create scheduled tasks using Windows Task Scheduler:
- Open Task Scheduler
- Create Basic Task
- Set trigger (daily, weekly, etc.)
- Action: Start a program
- Program:
filefortress.exe
- Arguments:
remotes scan