Plugin dups: find duplicate files in dir

This commit is contained in:
Arun Prakash Jana 2019-08-24 20:05:45 +05:30
parent eb3a9ad2ee
commit d8fe4b3bb6
No known key found for this signature in database
GPG Key ID: A75979F35C080412
4 changed files with 24 additions and 3 deletions

View File

@ -15,7 +15,6 @@
<a href="https://travis-ci.org/jarun/nnn"><img src="https://img.shields.io/travis/jarun/nnn/master.svg?label=travis" alt="Travis Status" /></a>
<a href="https://circleci.com/gh/jarun/workflows/nnn"><img src="https://img.shields.io/circleci/project/github/jarun/nnn.svg?label=circleci" alt="CircleCI Status" /></a>
<a href="https://github.com/jarun/nnn/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-BSD%202--Clause-yellow.svg?maxAge=2592000" alt="License" /></a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q"><img src="https://img.shields.io/badge/PayPal-donate-1eb0fc.svg" alt="Donate via PayPal!" /></a>
</p>
<p align="center">
@ -24,6 +23,10 @@
<p align="center"><i>Modes of nnn (light with filter, detail, du analyzer) with memory usage (click for a demo video)</i></a></p>
<p align="center">
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q"><img src="https://img.shields.io/badge/PayPal-donate-1eb0fc.svg" alt="Donate via PayPal!" /></a>
</p>
## Index
- [Introduction](#introduction)

View File

@ -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 |

15
plugins/dups Executable file
View File

@ -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

View File

@ -583,3 +583,5 @@ done
if [ "${check_update}" = "true" ]; then
check_for_update
fi
read dummy