Skip to main content

An utility for comparing files in 2 directories

Project description

ktreediff

An utility for comparing files in directories.

Pypi rejected the package name 'treediff' so I had to change package name to 'ktreediff' but 'treediff' command is available.

How to install

To install just run the following command. There's no external dependencies required.

$ pip install ktreediff

Command line options

usage: $ treediff [options...] <left> <right>
  Note: <left> and <right> can be a pair of files or a pair of directories

Examples:
To compare files in 2 directories dir_a and dir_b
  $ treediff dir_a dir_b

To compare files in 2 directories dir_a and dir_b, included subfolders
  $ treediff dir_a dir_b --recursive

To compare specific files (*.txt, *.psd) in 2 directories dir_a and dir_b
  $ treediff --filter .txt .psd dir_a dir_b

Exit code:
 0  : directories or files are the same
 1  : directories or files are different
 255: an error/exception occured

Utility for comparing directory/file

positional arguments:
  left                  specify left dir/file
  right                 specify right dir/file

options:
  -h, --help            show this help message and exit
  -r, --recursive       search file recursively
  -q, --quiet           be quiet
  -f FILTER [FILTER ...], --filter FILTER [FILTER ...]
                        file filters separated by space. Ex: -f .psd .txt ...

How to use

To compare 2 directories:

$ treediff dir_a dir_b
dir_a/           !=  dir_b/
    file_1.txt   ==      file_1.txt
    file_2.txt   ==      file_2.txt
    file_3.txt   !=      file_3.txt
    file_4.txt   ==      file_4.txt
    file_5.txt   !=      ...
    ...          !=      file_6.txt
    log_1.log    ==      log_1.log
    log_2.log    ==      log_2.log
    log_5.log    ==      log_5.log
    log_6.log    !=      ...
    sub_dir/     ==      sub_dir/

To compare 2 directories included their sub directories: use -r/--recursive option.

$ treediff dir_a dir_b -r
dir_a/               !=  dir_b/
    file_1.txt       ==      file_1.txt
    file_2.txt       ==      file_2.txt
    file_3.txt       !=      file_3.txt
    file_4.txt       ==      file_4.txt
    file_5.txt       !=      ...       
    ...              !=      file_6.txt
    log_1.log        ==      log_1.log
    log_2.log        ==      log_2.log
    log_5.log        ==      log_5.log
    log_6.log        !=      ...
    sub_dir/         !=      sub_dir/
        file1.log    ==          file1.log
        file2.log    !=          file2.log
        file3.log    ==          file3.log
        ...          !=          file4.log
        file5.log    !=          ...

To compare only *.txt files in 2 directories, use -f/--filter option. Note: You can specify multiple file types also, for example: -f .txt .log

$ treediff dir_a dir_b -r -f .txt 
dir_a/           !=  dir_b/
    file_1.txt   ==      file_1.txt
    file_2.txt   ==      file_2.txt
    file_3.txt   !=      file_3.txt
    file_4.txt   ==      file_4.txt
    file_5.txt   !=      ...
    ...          !=      file_6.txt
    sub_dir/     ==      sub_dir/

Or you can also just compare 2 files

$ treediff dir_a\file_1.txt dir_b\file_1.txt

2 files are identical at binary level

How to build and install locally

To build this project, run the following commands


$ git clone <this_repo_url>   <-- clone this project
$ cd treediff                 <-- move to project directory
$ pip install build           <-- install 'build' package, do this only once if not installed
$ python -m build             <-- build this project

After build this project, use the following command to install

$ pip install dist\ktreediff-<version>-py3-none-any.whl --force-reinstall

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ktreediff-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ktreediff-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file ktreediff-0.1.0.tar.gz.

File metadata

  • Download URL: ktreediff-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.7

File hashes

Hashes for ktreediff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 324dcc597b6be8581d9cdfaf368a0508bd722cf1d611c753825238e2807e3fa7
MD5 560d69b39eb0f7c3275ebc739878ed1e
BLAKE2b-256 4776e1079dd68228f8d069e8e06a4d096f7c99effbf2e43dc0de80702d1eaa0b

See more details on using hashes here.

File details

Details for the file ktreediff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ktreediff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.7

File hashes

Hashes for ktreediff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3f48625b6807653a498c5f8b8a5bd2bcbd2d95d01b60433ffc274636b25e75d
MD5 91ec4e5995a1c9c8787f5d2b340ebd01
BLAKE2b-256 91f3b0629a821ab238aa83fc0f75ed69dfe36edd3ac6244115cb9c0c9c4bfb62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page