A project to manage directories (without actually altering any real directories) using a series of commands.
- Create, delete, move, and list directories.
- Supports hierarchical directory structures.
- Python 3.x
To install this project, clone the repository and that's it! There are no external dependencies just make sure you have python 3 installed.
git clone https://github.com/yourusername/project-name.git
cd directory-tree
Once installed, make sure you’re in the correct directory (directory-tree
) and then run the script using one of the following commands, depending on your system:
python directories.py # For Windows or Linux
python3 directories.py # For macOS
The following commands are available for managing the directory tree:
*Note: commands will use uppercase for first word always so create
is valid as is CREATE
because it makes typing the commands a little easier.
- Usage:
CREATE <directory>
- Description: Creates a directory at the specified path. The directory must not already exist.
- Usage:
MOVE <source> <destination>
- Description: Moves a directory from one location to another. Both the source and destination directories must exist.
- Usage:
DELETE <directory>
- Description: Deletes the specified directory. The directory must exist and cannot be the root directory.
- Usage:
LIST
- Description: Lists all directories and their children, showing the structure in a tree-like format. Indentation indicates the depth of each directory relative to the root.
Examples:
CREATE howdy
CREATE howdy/partner
CREATE hello
Move howdy/partner hello
DELETE howdy
LIST
Output:
hello
howdy
partner
To run unit tests
python -m unittest test_directories.py