Giter VIP home page Giter VIP logo

dir-diff's Introduction

dir-diff

dir-diff is an utility that computes the difference between two directories and displays it in a human-friendly format.

Building

dir-diff is a regular Meson project, with no extra compile-time options.

To build it, you will need:

  • a C++20 compiler.
  • fmt if your C++ standard library does not provide std::format/std::print.

Usage

Basic usage is as follows:

$ dir-diff dir1 dir2

The two paths should point to the directories whose contents are to be compared.

For a list of options, see dir-diff --help.

When a difference is detected, the program will first print a legend, and the diff below.

How it works

The tool starts at the root of both directories, and first builds a union of the sets of files in both directories.

Then checks which files mismatch. The way the mismatch is detected is as follows (the steps are ordered in a way where if a match/mismatch is detected, further checks are skipped):

  1. the existence of the file in both directories is checked (mismatch if missing in one),
  2. the file type is compared (mismatch if not equal),
  3. the file contents are compared, for directories this means applying the same algorithm recursively, while for other file types:
    1. the file sizes are compared (regular files only, mismatch if not equal),
    2. the inode and device numbers they're on are compared (assumed same if numbers match),
    3. the link targets are compared (for symlinks),
    4. the file contents are compared (for regular files),
    5. the target device numbers are compared (for special files).

License

This project is licensed under the GPLv3 (or later) license.

Additionally, this project incorporates the wildmatch library as a submodule, which is licensed under the BSD-3-Clause license.

dir-diff's People

Contributors

qookei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.