VMois / dirjson

Command-line tool to list directories and files in JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dirjson

The simple command-line tool to list directories and files in JSON. Written in Golang.

Installation

To compile you need to have Golang already installed and configured on your computer. Then:

  1. Copy
$ git clone https://github.com/VMois/dirjson.git
$ cd dirjson
  1. Download dependencies and build
$ go get
$ go build -o dirjson.go
  1. Run
$ ./dirjson -p

Usage

  • To get help:
$ ./dirjson -h
  • to specify directory:
$ ./dirjson -d ./test_dir
  • pretty JSON output of current directory:
$ ./dirjson -p
{
  "path": "test_dir/",
  "dirs": [
    {
      "path": "test_dir/test2",
      "dirs": [],
      "files": [
        {
          "name": "file.txt",
          "size": 4
        }
      ]
    }
  ],
  "files": [
    {
      "name": "hello.txt",
      "size": 5
    },
    {
      "name": "world.txt",
      "size": 5
    }
  ]
}
  • recursive scan of current and all subdirectories:
$ ./dirjson -r
  • output JSON result to the file
$ ./dirjson -o folder_structure.json

Contributing

I'm open for any contributions. If you found a bug, or have a new feature/refactoring proposal, docs fix etc. please, open an issue for discussions. Thank you! :)

License

MIT License. More info in LICENSE

About

Command-line tool to list directories and files in JSON

License:MIT License


Languages

Language:Go 73.4%Language:Shell 26.6%