Plugin catalog
duplicate_file_detector
Marks files with identical contents in a listing and names the original and its other copies.
↓ on this page
duplicate_file_detector marks files with identical contents in a listing and names the other copies. Turn it on when you're clearing out a directory that has collected copies. It compares by size, then SHA-256, and treats the file with the oldest modified time as the original.
Turn it on
# ~/.config/lla/config.toml
enabled_plugins = ["duplicate_file_detector"]Or run this once. It saves the same setting, so the plugin stays on until you run lla --disable-plugin duplicate_file_detector.
lla --enable-plugin duplicate_file_detectorOutput appears in the default and long views (formats = ["default", "long"]), and in the table view, which uses the long format.
The plugin compares only the entries in the current listing. lla and lla -l compare one directory. To compare across subdirectories, use lla -l -R. lla -R on its own shows no duplicate data.
| Field | Type | Holds |
|---|---|---|
is_duplicate | boolean | The file is a copy of an older file |
original_path | path | The older file it copies |
has_duplicates | boolean | Newer copies of this file exist |
JSON also carries an untyped duplicate_paths string on files that have copies.
lla --json docs | jq '.[] | select(.name=="notes-copy.txt") | .plugin'{
"is_duplicate": true,
"original_path": "docs/notes.txt"
}Actions
Run an action with lla plugin run duplicate_file_detector <action>. Both actions are interactive, so they need a TTY and the default --output human. Running one also enables the plugin and saves that setting.
| Action | What it does |
|---|---|
clear-cache | Clears the hash cache and prints Cache cleared successfully. |
help | Prints usage. |
Example
lla docsnew.txt
notes-copy.txt
┌─
│ Status DUPLICATE of docs/notes.txt
└─
notes.txt
┌─
│ Status HAS DUPLICATES: docs/notes-copy.txt
└─lla -l --hide-group docs-rw-r--r-- 6B Nov 04 22:53 you notes-copy.txt
┌─
│ Status DUPLICATE
│ Original File docs/notes.txt
└─
-rw-r--r-- 6B Nov 04 22:53 you notes.txt
┌─
│ Status HAS DUPLICATES
│ Duplicate Copies docs/notes-copy.txt
└─Settings
~/.config/lla/plugins/duplicate_file_detector/config.toml sets colors in a [colors] table: info, has_duplicates, duplicate and path.