Giter Site home page Giter Site logo

dedup's Introduction

Dedup

Dedup is a command-line tool which deduplicates all files in the provided directories by merging them together into the first directory. The merge operation simultaneously removes duplicates and renames files (when a path collision occurs).

Install

Binaries

Releases Releases

See the latest release or download and install it now with curl https://i.jpillora.com/dedup! | bash

Source

$ go get -v github.com/jpillora/dedup

Usage

$ dedup --help

  Usage: dedup [options] directories...

  deduplicates all files in the provided directories, while optionally merging
  them into the first directory. The merge operation renames files (when a path
  collision occurs).

  Options:
  --keep, -k       keep duplicates (by default, duplicates are deleted)
  --merge, -m      move unique files into the first directory
  --recursive, -r  searches into nested directories
  --verbose, -v    verbose logs (displays each move and delete)
  --dryrun, -d     runs exactly as configured, except no changes are made
  --workers, -w    number of worker threads (default 4)
  --hash, -h       hashing algorithm to use (default md5, can also choose
                   sha1 and sha256)
  --help
  --version

  Notes:
  * dedup considers two files duplicates if they have matching hash sums.
  * dedup is a destructive operation (unless --keep).
  * dedup on a single directory will only perform deduplication, no moves.
  * dedup renames: when a file is unique, dedup will attempt to move the file.
    if the path already exists the incoming file will be suffixed with the next
    number (for example, if 'foo.txt' exists, the new file will be 'foo-2.txt').
  * enabling 'keep' without 'merge' enabled is a no-op.
  * any error will cause dedup to exit.

  Version:
    0.0.0-src

  Read more:
    github.com/jpillora/dedup

Example

$ cd example/
$ tree .
.
├── bar
│   ├── bar.txt
│   ├── foo-copy.txt
│   └── foo.txt
└── foo
    ├── bazz.txt
    └── foo.txt

2 directories, 5 files

$ dedup --verbose --dryrun --merge foo bar
[DRYRUN] Scanning foo (no changes)
[DRYRUN] Scanning bar (hashed 2)
[DRYRUN] Removing bar/foo.txt dupe-of foo/foo.txt (hashed 3)
[DRYRUN] Moving: bar/bar.txt -> foo/bar.txt (hashed 4)
[DRYRUN] Removing bar/foo-copy.txt dupe-of foo/foo.txt (hashed 5, moved 1, deleted 1)
[DRYRUN] Done (hashed 5, moved 1, deleted 2)

# looks good!

$ dedup --merge foo bar
Done (hashed 5, moved 1, deleted 2)

$ tree .
.
├── bar
└── foo
    ├── bar.txt
    ├── bazz.txt
    └── foo.txt

2 directories, 3 files

MIT License

Copyright © 2015 Jaime Pillora <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

dedup's People

Contributors

jpillora avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.