Skip to main content

Simple tool for creating directory trees in one shot

Project description

mktree

mktree is a simple tool for creating directory trees in one shot. This is somewhat similar to what the mkdir unix command can do, but with an easier syntax and better usability.

Installation

Arch users can simply run the following command from the project directory:

makepkg -si

Anyone else can use pip:

pip install --user mktree

Usage

mktree allows you to create complex directory trees with a simple syntax

 $ mktree -P this/is,a.bunch,of/directories
 .
 ├── this
 │   ├── is
 │   └── a
 ├── bunch
 └── of
	  └── directories

Th -P flag makes sure we are given a preview of the directory tree without actually creating any directory. For a simpler preview of all the directories that are going to be created, use the -p flag instead. A confirmation prompt is available with the -i flag.

You can find a complete list of all the available options here.

Now let's take a look at the string we've passed as argument. Notice how the argument string is made up of directories names separated by one of these three special characters: /, , and ..

Let's start with a very basic example

$ mktree -P A
.
└── A

This will simply create a directory A inside the current directory.

What if you want to create a folder B inside the folder A?

$ mktree -P A/B
.
└── A
    └── B

That's the purpose of the / character: it tells mktree to create the following directories inside the previous one.

Now a little more advanced example

$ mktree -P A/B,C
.
└── A
    ├── B
    └── C

This will create the directories B and C inside the directory A. The , character tells mktree to create the following directory at the same level of the previous one.

Continuing the above example, suppose that after you type C you need to create a folder D at the same level of the folder A. Remember that you've used the / character to move one level down the directory tree and now you want go back. That's when the . character comes in: it tells mktree to create the following directories one level up the directory tree

$ mktree -P A/B,C.D
.
└── A
│   ├── B
│   └── C
└── D

You can use the . character as much as you want but you can't move outside the current working directory directory

$ mktree -P A/B/C,D..E/F...H
.
├─ A
│  └─ B
│     ├─ C
│     └─ D
├─ E
│  └─ F
└─ H

License

See LICENSE.txt.

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

mktree-0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

mktree-0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file mktree-0.1.tar.gz.

File metadata

  • Download URL: mktree-0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.25.0 CPython/3.7.4

File hashes

Hashes for mktree-0.1.tar.gz
Algorithm Hash digest
SHA256 81c82c968ceaca5d286e55b4dcae945cfdd38354d5949a431ce36258889c11f5
MD5 9d9437731d24e7417511bf61b6aaa80f
BLAKE2b-256 b8489d303cf7898fdaed197af699d121558cbc5ceca64819042288b4eeef4551

See more details on using hashes here.

File details

Details for the file mktree-0.1-py3-none-any.whl.

File metadata

  • Download URL: mktree-0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.25.0 CPython/3.7.4

File hashes

Hashes for mktree-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1205dfe4fd8ad2c0f32f87a92993a7ec81a89c9c359d134ea7609e27267d03
MD5 a785630a58925afc05641ded574caef0
BLAKE2b-256 8c0d81f0ebba084313bcd9d1f919fc2d538513a2fb9b5936a469a25463415ee3

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