find

Search Files & Find Duplicates

The find command provides specialized file operations including duplicate detection.

Important: find query is Deprecated

The find query subcommand will be removed soon. Please migrate to the search command, which now provides all query functionality.

Quick Migration Guide

Simply replace find query with search. All options work the same:

find query --path-filter "*.pdf" search --path-filter "*.pdf"
find query --save-query myquery search --save-query myquery
find query --base-query myquery search --from-query myquery

Note: --base-query has been renamed to --from-query for clarity.

find duplicates ACTIVE

Find duplicate files across all connected storage and export deletion lists for cleanup.

filefortress find duplicates [OPTIONS]

Finds duplicates by name/size and by hash comparison for exact duplicates. Can export deletion lists in multiple formats.

Options

Option Description
--save-query Save the duplicate search as a named query
--view Display format: summary, list, json
--export-format Export format: paths, json, rclone, powershell, bash
--keep-strategy Which file to keep: oldest, newest, first, smallest, largest, by-remote
--keep-remote Remote name to prefer when using by-remote strategy
--output-file Save export to specified file path (alias: -o)
--hash-verified-only Only export hash-verified duplicates (safer, guaranteed matches)
--include-keep-file Include which file is being kept in the output (as comments)
--non-interactive Run in non-interactive mode (for scripting)

Keep Strategies

  • oldest - Keep file with earliest modified date
  • newest - Keep file with latest modified date
  • first - Keep first file found
  • smallest - Keep smallest file by size
  • largest - Keep largest file by size
  • by-remote - Keep file from specific remote (requires --keep-remote)

Export Formats

  • paths - Simple text list of file paths to delete
  • json - Structured JSON with complete duplicate information
  • rclone - Bash script with rclone delete commands (for cloud storage)
  • powershell - PowerShell script with deletion commands (for local files)
  • bash - Bash script with rm commands (for local files on Linux/macOS)

Complete Guide Available

For detailed information on duplicate management, including safety best practices and workflow examples, see the Duplicate File Management Guide.

Examples

Find duplicate files interactively:

filefortress find duplicates

Opens interactive menu to explore duplicate groups.

Export simple file list for deletion:

filefortress find duplicates --non-interactive \
  --export-format paths \
  --keep-strategy oldest \
  --hash-verified-only \
  --output-file duplicates-to-delete.txt

Exports paths of files to delete, keeping the oldest file from each group.

Generate rclone cleanup script:

filefortress find duplicates --non-interactive \
  --export-format rclone \
  --keep-strategy newest \
  --hash-verified-only \
  --include-keep-file \
  --output-file cleanup.sh

Creates a bash script with rclone delete commands for cloud storage cleanup.

Generate PowerShell cleanup script:

filefortress find duplicates --non-interactive \
  --export-format powershell \
  --keep-strategy oldest \
  --hash-verified-only \
  --output-file cleanup.ps1

Creates a PowerShell script for deleting local duplicate files on Windows.

Keep files from specific remote:

filefortress find duplicates --non-interactive \
  --export-format json \
  --keep-strategy by-remote \
  --keep-remote "Google Drive" \
  --hash-verified-only \
  --output-file cleanup.json

Exports JSON with files to delete, keeping files from "Google Drive" remote.

Search PDF files (use search command):

filefortress search --extensions pdf --path-filter "*report*"

Related Commands