Creating prototypes, managing and visualizing directories.
Project description
A pathlib-based python utility tool for directory management
Purpose
This project was designed as a utility package for larger scaling projects, it serves as an initialization section or as an instance with quick and controlled access to content of files and directories.
Features
- Fully mapped directory structures by the user
- Quick repository/database setups
- Basic files explorer features for directories and files within the module
- visual mapping for directories as a Tree-map or as a Table
Installation
To install the package, make sure you have python3 (version 3.12 and above recommended) and pip installed in your system, then run the command on the console:
pip install directory_manager
Or clone the repository using git and install with the following commands:
git clone https://github.com/isme2121/directory_manager
cd directory_manager
pip install -e .
Usage
Brief use case:
from directory_manager.directory import *
#creating an instance pointing to the current working directory
directory = Directory()
#add sub directories and sub files
directory.add_directories("sub-directory1", "sub-directory2", "sub-directory3")
directory.add_files("file.txt", "sub-directory1/data.json")
#or mirror the cwd in the files system to the instance
directory.image(rewrite=False) #keeping the data we already added with the argument
#returning references to other directories/files
sub_dir1 = directory["sub-directory1"]
if sub_dir1 is not None:
data = sub_dir1.get_file("data.json")
data["key"] = "foo"
#all previous execution had no effect on the files system
#populate method is used to update the files system with the instance data
directory.populate(rewrite=False, write_files=True)
#its important to keep rewrite as False in a sensitive directory
#otherwise it would re-build the entire directory and replace it with the new data
#results:
.
├───file.txt
├───sub-directory1
│ └───data.json
├───sub-directory2
└───sub-directory3
CLI commands
Viewing a directory as a tree, enter in the command line:
treeview .
or
treeview path/to/dir
Viewing a directory as a table, enter in the command line:
tableview . name type path parent size_kb latime
or
tableview path/to/dir name type path parent size_kb latime
To view the different keys for table view, run:
keysview
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file directory_manager-1.0.0.tar.gz.
File metadata
- Download URL: directory_manager-1.0.0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59717c1535f751df7b5de92e4af3f9a728ce3b87881ed56418fba3a57c47ef6b
|
|
| MD5 |
a9521c19fcb4a3fa5e30e6870863aab4
|
|
| BLAKE2b-256 |
a5b7f307d119aad18abd9a9198577c3da153b81fac7fd28c68f008daefbc1acd
|
File details
Details for the file directory_manager-1.0.0-py3-none-any.whl.
File metadata
- Download URL: directory_manager-1.0.0-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f532008d92bec100a3bb8e12144072b29e21f8de1a08a889643347842fb71211
|
|
| MD5 |
83071f1c95d9d160aca0c2ca92c0e984
|
|
| BLAKE2b-256 |
d8650e886d311c23a9209da39710e93dc0c3e0b672f27f979c59f557940190e9
|