This repo contains tools to compare two directories recursivly and visualise the results.
The script dircmp.py is used to compare two directories called left and right. Where left is the initial directory and right the modified directory.
Argument | Type | Description |
---|---|---|
-l, --left | string | Path of initial directory (left) |
-r, --right | string | Path of modified directory (right) |
-f, --format | string | Specify output format: text or json (default: text) |
-b, --brief | flag | If specified, only summary is printed (text output only) |
-u, --skip-sort | flag | If specified, output is not sorted (text output only) |
> test/create_test_data.sh
> ./dircmp.py -l /tmp/dir-compare/test/left -r /tmp/dir-compare/test/right
# compare /tmp/dir-compare/test/left vs. /tmp/dir-compare/test/right
#
# unchanged files: 2
# removed files: 3
# added files: 3
# changed files: 2
#
# total files: 10
U subdir/unchanged
U unchanged
D removed
D removed_subir/removed
D subdir/removed
A added
A added_subir/added
A subdir/added
M changed
M subdir/changed
Takes the json output from dircmp and converts it into a tree structure.
Argument | Type | Description |
---|---|---|
-i, --input | string | Optional. Speficies the path of the input file (default: use stdin) |
-n, --name | string | Optional. Name of the root node (default: root) |
-p, --pretty | flag | If specified, JSON output is pretty printed |
> test/create_test_data.sh
> ./dircmp.py -l /tmp/dir-compare/test/left -r /tmp/dir-compare/test/right -f json | ./gentree.py -p
{
"name": "root",
"weight": 15,
"children": [
{
"name": "unchanged",
"weight": 3,
"children": [
{
"name": "subdir",
"weight": 2,
"children": [
{
"name": "unchanged",
"weight": 1,
"children": []
}
]
},
// ...
]
}
]
}
Generates a sunburst chart out of a tree.
Argument | Type | Description |
---|---|---|
-i, --input | string | Optional. Speficies the path of the input file (default: use stdin) |
> test/create_test_data.sh
> ./dircmp.py -l /tmp/dir-compare/test/left -r /tmp/dir-compare/test/right -f json > changes.json
> ./gentree.py -i changes.json > tree.json
> ./gensunburst.py -i tree.json > changes.svg