From d8fe4b3bb681d4452a4911b5f480531e07239b1d Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 24 Aug 2019 20:05:45 +0530 Subject: [PATCH] Plugin dups: find duplicate files in dir --- README.md | 5 ++++- plugins/README.md | 5 +++-- plugins/dups | 15 +++++++++++++++ plugins/imgur | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 plugins/dups diff --git a/README.md b/README.md index 201e1619..eb4edc67 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ Travis Status CircleCI Status License -Donate via PayPal!

@@ -24,6 +23,10 @@

Modes of nnn (light with filter, detail, du analyzer) with memory usage (click for a demo video)

+

+Donate via PayPal! +

+ ## Index - [Introduction](#introduction) diff --git a/plugins/README.md b/plugins/README.md index 47a7aab0..a0328834 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -5,6 +5,7 @@ The currently available plugins are listed below. | Plugin (a-z) | Lang | Deps | Description | | --- | --- | --- | --- | | boom | sh | SMPlayer | Play random music from dir (modify `PLAYER`) | +| dups | sh | find, md5sum,
sort uniq xargs | List non-empty duplicate files in current directory | | checksum | sh | md5sum,
sha256sum | Create and verify checksums | | fzy-open | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open | | getplugs | sh | wget | Update plugins | @@ -17,12 +18,12 @@ The currently available plugins are listed below. | mocplay | sh | [moc](http://moc.daper.net/) | Appends (and plays, see script) selection/dir/file in moc| | ndiff | sh | vimdiff | Diff for selection (limited to 2 for directories) | | nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user | -| nwal | sh | nitrogen | Set the selected image as wallpaper using nitrogen | +| nwal | sh | nitrogen | Set image as wallpaper using nitrogen | | organize | sh | file | Auto-organize files in directories by file type | | pastebin | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of (text) file to paste.ubuntu.com | | pdfview | sh | pdftotext/
mupdf-tools | View PDF file in `$PAGER` | | picker | sh | nnn | Pick files and pipe the newline-separated list to another utility | -| pywal | sh | pywal | Set selected image as wallpaper, change terminal color scheme | +| pywal | sh | pywal | Set image as wallpaper, change terminal colorscheme | | readit | sh | pdftotext, mpv,
pico2wave | Read a PDF or text file aloud | | ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file | | splitjoin | sh | split, cat | Split file or join selection | diff --git a/plugins/dups b/plugins/dups new file mode 100755 index 00000000..06430251 --- /dev/null +++ b/plugins/dups @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Description: List non-empty duplicate files in the current directory (based on size followed by MD5) +# +# Source: https://www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash +# +# Requires: find md5sum sort uniq xargs +# +# Shell: POSIX compliant +# Author: syssyphus + +find -size +0 -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate + +echo "Press any key to exit" +read dummy diff --git a/plugins/imgur b/plugins/imgur index 5b6d4ebd..8b39b557 100755 --- a/plugins/imgur +++ b/plugins/imgur @@ -583,3 +583,5 @@ done if [ "${check_update}" = "true" ]; then check_for_update fi + +read dummy