zsh-users
 help / color / mirror / code / Atom feed
* find duplicate files
@ 2019-04-06  5:40 Emanuel Berg
  2019-04-06 13:02 ` Paul Hoffman
  0 siblings, 1 reply; 22+ messages in thread
From: Emanuel Berg @ 2019-04-06  5:40 UTC (permalink / raw)
  To: zsh-users

Is this any good? Can it be done lineary?

TIA

#! /bin/zsh

find-duplicates () {
    local -a files
    [[ $# = 0 ]] && files=("${(@f)$(ls)}") || files=($@)

    local dups=0

    # files
    local a
    local b

    for a in $files; do
        for b in $files; do
            if [[ $a != $b ]]; then
                diff $a $b > /dev/null
                if [[ $? = 0 ]]; then
                    echo $a and $b are the same
                    dups=1
                fi
            fi
        done
    done
    [[ $dups = 0 ]] && echo "no duplicates"
}
alias dups=find-duplicates

-- 
underground experts united
http://user.it.uu.se/~embe8573


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-04-09  9:30 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-06  5:40 find duplicate files Emanuel Berg
2019-04-06 13:02 ` Paul Hoffman
2019-04-06 14:44   ` Emanuel Berg
2019-04-06 19:11     ` zv
2019-04-06 19:42       ` Emanuel Berg
2019-04-08 14:37         ` Paul Hoffman
2019-04-08 14:58           ` Ray Andrews
2019-04-08 15:14             ` Volodymyr Khomchak
2019-04-08 15:24             ` Peter Stephenson
2019-04-08 15:32             ` Andrew J. Rech
2019-04-08 15:47             ` Oliver Kiddle
2019-04-08 16:29               ` Ray Andrews
2019-04-08 16:45                 ` Bart Schaefer
2019-04-08 21:30               ` Emanuel Berg
2019-04-09  1:08             ` Jason L Tibbitts III
2019-04-09  1:28               ` Ray Andrews
2019-04-09  9:28               ` Charles Blake
2019-04-08 21:26           ` Emanuel Berg
2019-04-07 11:16       ` Charles Blake
2019-04-07 21:32         ` Bart Schaefer
2019-04-08 11:17           ` Charles Blake
2019-04-08 17:14             ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).