Giter Site home page Giter Site logo

dedup's Introduction

dedup

shell script to remove duplicate files

Background

History

Greatly inspired by rdfind, but limited by lack of certain features and inability to add them due to lack of C++ knowledge, I decided to do what? Right, to implement my own version, in plain shell, using a database.

Idea

Idea is simple: have a database with a table, with one row for each file, and columns for each property (like size, first and last bytes, checksum, etc). Different scriptlets will add such columns, and an SQL query will delete unique rows. After that, each group of duplicate rows should be hardlinked to each other.

To properly work with already hardlinked files (they have same inodes), we have two tables: "main" one with one file per inode (this can be trivially implemented by adding a UNIQUE constraint to the 'inode' column), and another one with inode-to-all-filenames mapping (actually, with list of all files).

Usage

Requirements

  • shell (currently, busybox)
  • sqlite3
  • sed, find

Sample scripts

You can find sample script is in sample.sh. Run it, passing as arguments list of directories to scan for duplicates. But you probably should look at it first and maybe comment out last lines and check the database to see what is going to happen.

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.