aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-08-24 20:05:45 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-08-24 21:23:52 +0530
commitd8fe4b3bb681d4452a4911b5f480531e07239b1d (patch)
tree9ee9fa2eb110e81e5e1562051d111dff5e0e8431 /plugins
parenteb3a9ad2ee86ec518f04911d413797e35c48e0d3 (diff)
downloadnnn-d8fe4b3bb681d4452a4911b5f480531e07239b1d.tar.gz
Plugin dups: find duplicate files in dir
Diffstat (limited to 'plugins')
-rw-r--r--plugins/README.md5
-rwxr-xr-xplugins/dups15
-rwxr-xr-xplugins/imgur2
3 files changed, 20 insertions, 2 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 47a7aab..a032883 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,<br>sort uniq xargs | List non-empty duplicate files in current directory |
| checksum | sh | md5sum,<br>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/<br>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,<br>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 0000000..0643025
--- /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 5b6d4eb..8b39b55 100755
--- a/plugins/imgur
+++ b/plugins/imgur
@@ -583,3 +583,5 @@ done
if [ "${check_update}" = "true" ]; then
check_for_update
fi
+
+read dummy